Using counter to toggle LED

Go To Last Post
31 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello everyone,
I am using ATMEL mega2560 to toggle LED.

On the page 156 of the datasheet there are Timer/Counter control registers http://www.atmel.com/Images/Atme...

so I wrote the little program

http://textuploader.com/58gdj

 

</p>
<p>#include <avr/io.h><br />
#include <util/delay.h><br />
 <br />
int main(void)<br />
{<br />
    DDRB = 0x01;<br />
    PORTB |= 1<<PINB6;<br />
    TCCR1B |= 1<<CS10;<br />
    int i = 0;<br />
    while(1)<br />
    {<br />
      if (TCNT1 > 10000)<br />
      {<br />
        i++;<br />
        TCNT1 = 0;<br />
        if(i > 100)<br />
        {<br />
          i = 0;<br />
          PORTB ^= 1<<PINB6;<br />
        }          <br />
      }<br />
      <br />
    }<br />
}</p>
<p>

I don't know why I get code gets like this , so I posted it also here

http://textuploader.com/58gdj

 

Problem is that the LED flashes like 5 times and after that it just stops blinking.
The LED in series with 330 ohm resistor connected to the digital pin 12 (PINB6).

Last Edited: Sun. Aug 28, 2016 - 10:07 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

First, here is the code:

#include <avr/io.h>

int main(void)
{
    DDRB = 0x01;
    PORTB |= 1<<PINB6;
    TCCR1B |= 1<<CS10;
    int i = 0;
    while(1)
    {
      if (TCNT1 > 10000)
      {
        i++;
        TCNT1 = 0;
        if(i > 100)
        {
          i = 0;
          PORTB ^= 1<<PINB6;
        }          
      }
    }
}

 

Second, DDRB = 0x01 does not set your LED pin (PB6) as an output (but PB0). You should have instead:

    DDRB = 1<<DDB6

The way it is, you're using the integrated pull-up resistor, which means your LED does not have a 330Ω resistor in line, but several dozen kΩ.

Don't tell me you haven't noticed it was kind of dim…

 

ɴᴇᴛɪᴢᴇᴎ

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yeah I didn't even notice that I set pin0 to the output,

I usually write

</p>
<p>DDRB = 1<<PINB6</p>
<p>

I did not know I could use DDB6 too.

 

I actually did not notice it to be kind of dim, not quite sure why.

Also if I wanted it to blink 1 every second what would I have to write?

Thank you for help.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I see from editing your post that you are using [ code ] tags. Do not do that - they don't work correctly on this new site (as the code in your two previous posts clearly shows!). If you want to post code click the icon that looks like "<>" on the editor toolbar then paste your code into the pop up window that appears.

 

Moderator.

 

PS

SimpleThings wrote:
it to blink 1 every second

Until you reveal the CPU frequency I doubt anyone here can answer that.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've found on the datasheet it's 16MHz , so I need to wait 16x10^6 oscillations?

if (TCNT1 > 16000000)

Doesn't seem to work.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The datasheet cannot tell you what frequency you're running at.  It can only tell you the maximum frequency you can run at.  Unless you've altered the fuses, I believe you are running at 1Mhz with the internal oscillator, but I don't have the datasheet handy.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What are you talking about. The datasheet is not going to say what speed YOUR circuit happens to run it at. The datasheet puts forward a load of possible ways the CPU can be clocked. When, for example, you choose to use an external crystal there are literally hundreds and hundreds of different crystal speeds such a circuit might be using. The only reason it might be running at 16MHz is if it is set to use either an external crystal or an external clock and the one chosen for the circuit just happens to be 16MHz.

if (TCNT1 > 16000000)

As far as I know there is none of the 300+ models of AVR where that condition could EVER be true.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How can I check or set the frequency of the uC?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Exactly as it says in the datasheet.

 

But this board you have your mega2560 on: Is this something you have put together from scratch or is this a commercially designed board? If the latter where did you buy it from? Did they not give a user manual? Did the description of the product not mention the speed of the AVR? If it's your own design how can you have laid out a PCB to accommodate a QFP SMT chip and not consider/know the clock source?

 

Anyway the bottom line is that for any AVR you set CKSEL fuse bits and they enable some form of clock to the CPU. Either something built internally within the chip (most AVRs come with the CPU connected to an internal 1MHz) or if an external clock or an external crystal is used the CKSEL bits enable the appropriate source and the actual speed comes from whatever the can of quartz or clocking circuitry happens to supply. So you may set the CKSEL bits of an AVR to say "use a crystal" then if you connect a 1MHz crystal it will run at 1MHz. If you connect a 3.6864MHz crystal it will run at 3.6864MHz. If you connect a 16MHz crystal it will run at 16MHz and so on....

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This is the item I bought

 

http://www.ebay.com/itm/40093536...

The only thing it says:

Clock speed: 16MHz

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SimpleThings wrote:
This is the item I bought

http://www.ebay.com/itm/40093536...

That definitely is a 16MHz board. :-)

ɴᴇᴛɪᴢᴇᴎ

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

netizen wrote:

SimpleThings wrote:

This is the item I bought

 

http://www.ebay.com/itm/40093536...

That definitely is a 16MHz board. :-)

 

So please tell me the equation to calculate the delay of the 1 second duration. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you intend to use that thing, you're gonna need to be able to find this kind of information yourself. We're here to help you learn, not do all the work for you.

Here is the datasheet. You want to look at chapter 17: 16-bit Timer/Counter.

More specifically you want to look at the TCR1B special register, and how you set the prescaler using the CS1x fields (17.11.5).

Read that, then come back for help if there's something you don't understand.

ɴᴇᴛɪᴢᴇᴎ

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh, if you'd just said "Arduino" then everyone would know what you were talking about.

 

The fact is that flash at some fixed rate you would want to run the timer in Clear on Timer Compare (CTC) mode. 

 

Now if a timer were just to count one "tick" for each pulse of the CPU clock when that clock was running at 16MHz it would take 16,000,000 ticks for it to elapse one second. But AVR timers are just 8bit or 16 bit so they only count a maximum of 256 (8bit) or 65536 (16 bit) steps. So you want to slow the timer down so that 1second is a maximum of 256 (not practical as timers cannot be slowed that much!) or 65536 ticks. So next you look at the prescaler options for one of 16 bit timers in the mega2560. You will find it has settings for /256 and /1024. If you run it at /256 then a count of 62,500 will be 1 second (that is 16,000,000 / 256). If you run it at /1024 then a count of 15,625 will represent 1 second. Either count fits nicely into the 65536 range of the 16 bit timer.

 

So if you set the CS bits of the timer to select /256 mode then you want the timer to count to 62500 then let you know it's got there. If you set them for /1024 mode then you want it to count 15625 steps. In CTC mode you would actually set the compare register to be 15624 or 62499 as 0 counts as one "tick". 

 

To select CTC mode (WGM mode 4) you need to set the WGM12 bit before you set the CS bits for the timer to start it. You also need to set the "top count" value in the OCR1A register. Now when you start the timer (by select /256 or /1024) the TCNT1 will begin to count up and when the value in TCNT1 matches the value in OCR1A the timer will note the fact then set TCNT1 back to 0 and the process repeats.

 

The OCF1A bit in TIFR1 will be set when the timer reaches the count and resets. This is the thing you need to sit and watch for. When it occurs change the state of the output LED or whatever and then set this bit back to 0.

 

So you are no longer looking for TCNT1 reaching a certain value (the timer is effectively doing this for you). You are just looking for a single flag bit to tell you that the timer has seen this happen.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

netizen wrote:
Read that, then come back for help if there's something you don't understand.

…Or you can just read clawson's post. :-]

ɴᴇᴛɪᴢᴇᴎ

Last Edited: Sun. Aug 28, 2016 - 06:41 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Look at OP's posts here - he's not going to suddenly get all that by just reading a dry datasheet. Sure an engineer with 5+ years of experience could just flick through the datasheet, recognize CTC mode for what it is and setup the conditions to use it. But someone who'd just got an Arduino board and wants to flash an LED is unlikely to get that in a day, week or even a month of studying the datasheet.

 

Of course there is an argument to say that if you have an Arduino and you want fast results you can get quicker rewards by using the Arduino IDE and example code.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:
Look at OP's posts here - he's not going to suddenly get all that by just reading a dry datasheet.

I did not dare assuming anything of the likes about what he can or cannot do, but I admit you're most probably right. My point was to lead him towards the ultimate source of information. If that's too dry for him, then there are good timer tutorials freely available. If these are too dry too, we're here to help out. But I don't think giving him the "formula" as he asked really is a good idea.

I mean, do you really think his ultimate goal is to blink a LED at 1Hz? Quite surely, this is just a step toward another goal, that again will require understanding a bit more what he's doing.

But if you feel differently, and more specifically you're ok with babysitting him through the process, I sure won't stand in the way. :-)

ɴᴇᴛɪᴢᴇᴎ

Last Edited: Sun. Aug 28, 2016 - 07:15 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

netizen wrote:
you're ok with babysitting him through the process

Well I sort of assumed that was the entire raison d'etre for AVR Freaks. But perhaps I got that wrong in which case the last 80,000+ posts were probably all for naught :-O

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Come on, don't be dramatic, you know what I meant: give a man a fish… :-)

I hope he realizes how lucky he is, and that motivates him to do his part of the fishing…

ɴᴇᴛɪᴢᴇᴎ

Last Edited: Sun. Aug 28, 2016 - 08:49 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:

Oh, if you'd just said "Arduino" then everyone would know what you were talking about.

 

The fact is that flash at some fixed rate you would want to run the timer in Clear on Timer Compare (CTC) mode. 

 

Now if a timer were just to count one "tick" for each pulse of the CPU clock when that clock was running at 16MHz it would take 16,000,000 ticks for it to elapse one second. But AVR timers are just 8bit or 16 bit so they only count a maximum of 256 (8bit) or 65536 (16 bit) steps. So you want to slow the timer down so that 1second is a maximum of 256 (not practical as timers cannot be slowed that much!) or 65536 ticks. So next you look at the prescaler options for one of 16 bit timers in the mega2560. You will find it has settings for /256 and /1024. If you run it at /256 then a count of 62,500 will be 1 second (that is 16,000,000 / 256). If you run it at /1024 then a count of 15,625 will represent 1 second. Either count fits nicely into the 65536 range of the 16 bit timer.

 

So if you set the CS bits of the timer to select /256 mode then you want the timer to count to 62500 then let you know it's got there. If you set them for /1024 mode then you want it to count 15625 steps. In CTC mode you would actually set the compare register to be 15624 or 62499 as 0 counts as one "tick". 

 

To select CTC mode (WGM mode 4) you need to set the WGM12 bit before you set the CS bits for the timer to start it. You also need to set the "top count" value in the OCR1A register. Now when you start the timer (by select /256 or /1024) the TCNT1 will begin to count up and when the value in TCNT1 matches the value in OCR1A the timer will note the fact then set TCNT1 back to 0 and the process repeats.

 

The OCF1A bit in TIFR1 will be set when the timer reaches the count and resets. This is the thing you need to sit and watch for. When it occurs change the state of the output LED or whatever and then set this bit back to 0.

 

So you are no longer looking for TCNT1 reaching a certain value (the timer is effectively doing this for you). You are just looking for a single flag bit to tell you that the timer has seen this happen.

Thank you for really informative post.I will try it when I come home.

 

Guys, I really appreciate everyones help, I thought it's much simplier to get the 1 second delay, but yeah I should have googled that instead.

I've already learnt mbed and Arduino IDE ,yeah it's much easier with already built in classes, but I don't think it's good educational material and you are dependent on the other ones libraries and mbed forum really sucks, you need to wait weeks to get replay.

I will have next two semesters two subjects about microcontrollers, about 8051 and NXP uC based on 8051 architecture,so I am kinda a new to the uCs, that is why I wanted to get a starting point by myself and I think AVR is a good choice over other uCs. 

I think I will get this book

http://shop.oreilly.com/product/...

and I hope this book will give me some good start so I don't have to ask basic things here.

I also bought ATMEGA324p, because I started watching NewbieHack series https://www.youtube.com/playlist...

Best regards, Ivan.

Last Edited: Mon. Aug 29, 2016 - 06:13 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SimpleThings wrote:
...get a starting point by myself...

 

IMO, you were off to a fair start with your original post. [except for the "stop blinking" part...did that ever get resolved?]

 

-- You established a timer "tick" of a certain duration.

-- You then counted thos ticks to do the application timing.

 

That IMO/IME is the right approach!

 

-- That said, most of us would let the timer do a lot more of the work.

-- Since AT90Snnnn became obsolete some 15 years ago, AVR8 timers have a CTC mode, and no more fussing with TCNTn.

-- Yes, most of my apps will have a "tick" of e.g. 10ms, and count them for longer timing.

-- But for a single purpose, one might configure the timer for the entire 1 second or whatever.

-- Side note:  As was apparent above, one >>must<< know what speed the AVR is running at.

-- The timer prescaler can slow down the timer counting to give more range.

-- Timer flags are set when events occur -- compare match (for CTC) and overflow.

-- One can poll the flag(s) and clear and do the actions when the event occurs...

-- ...or trigger an interrupt and invoke an ISR.

 

If you get your original posted app going to your satisfaction, and understand it, then I'd say you can just continue with timer Tutorials and such.  Dim that LED next. ;)

 

 

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes I resolved "stop blinking" part, I accidentally set PINB0 as the output.

Thank you for your tips, I will definitely get more into the counters, I mean I learnt about them in digital electronics ,but I never used in uCs.

I've just ordered ATmega168, since book "AVR Programming by Elliot Williams" uses that chip.

Ivan.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SimpleThings wrote:
I've just ordered ATmega168, ...

 

Many here will mention/recommend getting an Arduino clone delivered to your door for a few dollars total.  Chances are you spent more than that for your single chip, and you have to put reasonable circuitry around it.

 

In short terms, with an appropriate model of Arduino clone all you need is a USB cable to get started, as it already has a bootloader pre-loaded.

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:

SimpleThings wrote:

I've just ordered ATmega168, ...

 

 

Many here will mention/recommend getting an Arduino clone delivered to your door for a few dollars total.  Chances are you spent more than that for your single chip, and you have to put reasonable circuitry around it.

 

In short terms, with an appropriate model of Arduino clone all you need is a USB cable to get started, as it already has a bootloader pre-loaded.

 

 

I've found this item, other nano versions were using ATmega328

http://www.ebay.com/itm/Geeetech...

 

I found this one too

http://www.ebay.com/itm/Pro-Mini...

 

But it doesn't have USB port, I guess I have to buy it and solder it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello,

   To get a one-second LED flash  (which I am assuming is a 1-second period) in Arduino C, use:

     do  {

        delay(500);

        digitalWrite(12, !digitalRead(12));

     } while (1);

 

    To do other things while the LED is flashing, you could use:

    void loop() {

        boolean  isLEDtoggleNeeded == true;   // I like to use the "is_Something" format to indicate boolean variables

 

            if ( (millis() % 500 == 0)  {

                if (isLEDtoggleNeeded == true) ) {

                      isLEDtoggleNeeded = false;

                      digitialWrite(12, !digitalRead(12));  // toggle only once every half second

                }

           }

           if ( (millis() % 501 == 0)  isLEDtoggleNeeded = true;  

 

           ... other loop things here...

       }

 

    The millis() function in Arduino returns a long value for the number of 1/1000 seconds (milliseconds) since the last power-on/reset.   millis(() mod 500 == 0  will be true every 1/2 a second.  But it will be true for the entire 1 millisecond period.  However if the loop() activities complete in less than 1 millisecond, then the loop will begin again before the millis() value has changed, and it will toggle the LED again because the toggle condition is true.  Hence the boolean flag: isLEDtoggleNeeded.   The boolean will be set to true multiple times during the 1 millisecond period while the millis() value mod 501 is 0, but this will not affect the operation of the program.

 

It is possible to directly set the timers to do activities like toggle LEDs in the background by putting custom values into the peripheral control registers on the AVR. But those techniques will only work on an AVR with a 16-bit timer.   The great advantage of using Arduino is that your shield code will work -unchanged- on any Arduino CPU platform.  Arduino at the present time is 99% AVR, but that will change as the years go by.

Last Edited: Mon. Aug 29, 2016 - 08:48 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SimpleThings wrote:

 

I've found this item, other nano versions were using ATmega328

http://www.ebay.com/itm/Geeetech...

 

I found this one too

http://www.ebay.com/itm/Pro-Mini...

 

But it doesn't have USB port, I guess I have to buy it and solder it.

 

Well, but you should get the 328 version, it has more flash memory and it's cheaper, otherwise they are identical:

http://www.ebay.com/itm/1PCS-MICRO-USB-Nano-V3-0-ATmega328P-CH340G-5V-16M-Micro-controller-Arduino-/191773759569?hash=item2ca69b5851:g:aHAAAOSwLN5WiNjA

 

And you can't just solder a usb port to the USB-less version, these ATMegas don't have an internal USB interface. They need a USB chip. Currently, the most popular in the chinese nano clones is the winchiphead (lol, these chinese company names...) CH340G.

 

You can buy an external serial to USB adapter for the arduinos without USB (it's also useful for other things). These ones use a Silicon Labs chip:

http://www.ebay.com/itm/1pcs-6Pin-USB-2-0-to-TTL-UART-Serial-Converter-CP2102-STC-Replace-Ft232-/221967504639?hash=item33ae4b54ff:g:ViAAAOSwsB9WCNWw

 

It's good because it has 3.3V logic, so it can interface with both 5V and 3.3V devices.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Simonetta wrote:

Hello,

   To get a one-second LED flash  (which I am assuming is a 1-second period) in Arduino C, use:

     do  {

        delay(500);

        digitalWrite(12, !digitalRead(12));

     } while (1);

 

    To do other things while the LED is flashing, you could use:

    void loop() {

        boolean  isLEDtoggleNeeded == true;   // I like to use the "is_Something" format to indicate boolean variables

 

            if ( (millis() % 500 == 0)  {

                if (isLEDtoggleNeeded == true) ) {

                      isLEDtoggleNeeded = false;

                      digitialWrite(12, !digitalRead(12));  // toggle only once every half second

                }

           }

           if ( (millis() % 501 == 0)  isLEDtoggleNeeded = true;  

 

           ... other loop things here...

       }

 

    The millis() function in Arduino returns a long value for the number of 1/1000 seconds (milliseconds) since the last power-on/reset.   millis(() mod 500 == 0  will be true every 1/2 a second.  But it will be true for the entire 1 millisecond period.  However if the loop() activities complete in less than 1 millisecond, then the loop will begin again before the millis() value has changed, and it will toggle the LED again because the toggle condition is true.  Hence the boolean flag: isLEDtoggleNeeded.   The boolean will be set to true multiple times during the 1 millisecond period while the millis() value mod 501 is 0, but this will not affect the operation of the program.

 

It is possible to directly set the timers to do activities like toggle LEDs in the background by putting custom values into the peripheral control registers on the AVR. But those techniques will only work on an AVR with a 16-bit timer.   The great advantage of using Arduino is that your shield code will work -unchanged- on any Arduino CPU platform.  Arduino at the present time is 99% AVR, but that will change as the years go by.

 

Hello , thank you for your answer, but If you read my other posts, you would read that already know how to program in Arduino IDE and it's very easy if you had subjects in C/C++ but I don't like it really , I was making electrical car with remote control and I've seen so many disadvantages for not working on the low level with uC, I don't find arduino good for educational purposes, if you are a just doing it for hobby, it's okay, but me as an engineer student, hm I don't think so. But thank you for your help.

 

 

 

 

El Tangas wrote:

SimpleThings wrote:

 

 

I've found this item, other nano versions were using ATmega328

 

http://www.ebay.com/itm/Geeetech...

 

I found this one too

http://www.ebay.com/itm/Pro-Mini...

 

But it doesn't have USB port, I guess I have to buy it and solder it.

 

Well, but you should get the 328 version, it has more flash memory and it's cheaper, otherwise they are identical:

http://www.ebay.com/itm/1PCS-MICRO-USB-Nano-V3-0-ATmega328P-CH340G-5V-16M-Micro-controller-Arduino-/191773759569?hash=item2ca69b5851:g:aHAAAOSwLN5WiNjA

 

And you can't just solder a usb port to the USB-less version, these ATMegas don't have an internal USB interface. They need a USB chip. Currently, the most popular in the chinese nano clones is the winchiphead (lol, these chinese company names...) CH340G.

 

You can buy an external serial to USB adapter for the arduinos without USB (it's also useful for other things). These ones use a Silicon Labs chip:

http://www.ebay.com/itm/1pcs-6Pin-USB-2-0-to-TTL-UART-Serial-Converter-CP2102-STC-Replace-Ft232-/221967504639?hash=item33ae4b54ff:g:ViAAAOSwsB9WCNWw

 

It's good because it has 3.3V logic, so it can interface with both 5V and 3.3V devices.

 

I didn't know that 328 is the basically the same chip as 168. I've ordered the items that you provided on the links above, yeah chinese company names know to be so weird sometimes.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SimpleThings wrote:
I don't find arduino good for educational purposes, if you are a just doing it for hobby, it's okay, but me as an engineer student, hm I don't think so.

Interesting, as we have designed several "shield" boards for different departments of a local university for research projects.  The base is an Arduino.  That saves the departments the task and possible woes of designing the microcontroller app from scratch.

 

But suit yourself.  If you don't use the timer that the Arduino model uses for millis() and related, you can do your app above in the Arduino environment if you care to.

 

Anyway. as I said above I think you are on an OK path, making "ticks" and counting them.  A trip through a timer tutorial or two and you should be well on your way.

 

 

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:

SimpleThings wrote:

I don't find arduino good for educational purposes, if you are a just doing it for hobby, it's okay, but me as an engineer student, hm I don't think so.

 

Interesting, as we have designed several "shield" boards for different departments of a local university for research projects.  The base is an Arduino.  That saves the departments the task and possible woes of designing the microcontroller app from scratch.

 

But suit yourself.  If you don't use the timer that the Arduino model uses for millis() and related, you can do your app above in the Arduino environment if you care to.

 

Anyway. as I said above I think you are on an OK path, making "ticks" and counting them.  A trip through a timer tutorial or two and you should be well on your way.

 

 

 

I was talking about the programming part, I mean you really don't need to be an engineer to program arduino or have any deep knowledge about digital electronics and uCs, but that is just my opinion, I might be wrong.

Since I am planning to get into embedded engineering for the masters program(I am Automation and control undergraduate student), I want to get deeper into uCs architecture and principles.

Yes ,arduino is great because of the shields and it easy to use.

Last Edited: Tue. Aug 30, 2016 - 07:04 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

SimpleThings wrote:
I want to get deeper into uCs architecture and principles.

No disagreements there.

 

SimpleThings wrote:
I was talking about the programming part, I mean you really don't need to be an engineer to program arduino or have any deep knowledge about digital electronics and uCs, but that is just my opinion, I might be wrong.

Well, I'll use a couple of analogies.

 

While indeed I'm an engineering grad and learned my computers from the "inside out", I spent a past lifetime working for Burroughs Corp and programming mainframes.  While indeed from time to time I needed to know about certain peripherals and such, in general I and my cohorts had little idea what was inside the "big iron" and couldn't begin to design such a beastie.

 

Similarly, one can be a very good driver and have no idea how to design a vehicle.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

theusch wrote:

SimpleThings wrote:

I want to get deeper into uCs architecture and principles.

 

No disagreements there.

 

 

SimpleThings wrote:

I was talking about the programming part, I mean you really don't need to be an engineer to program arduino or have any deep knowledge about digital electronics and uCs, but that is just my opinion, I might be wrong.

 

Well, I'll use a couple of analogies.

 

While indeed I'm an engineering grad and learned my computers from the "inside out", I spent a past lifetime working for Burroughs Corp and programming mainframes.  While indeed from time to time I needed to know about certain peripherals and such, in general I and my cohorts had little idea what was inside the "big iron" and couldn't begin to design such a beastie.

 

Similarly, one can be a very good driver and have no idea how to design a vehicle.

Well I've never worked as an engineer , so you are probably right about the part that I don't need to know really how some things work from the inside, but for the sake of my masters degree I think I need to get deeper into uCs since I want to go for embedded systems engineering.