Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 4928

Need assistaance with TIMER

$
0
0
Hi,
I have written the code for led blinking, using timer0 of ATmega2560 on AtmelStudio7. When I run it on simulator, the status of led(s) changes without timer reaching the set value. Can someone assist me with this..? Thanks in advance..
Here is the code:
Code (Text):
  1.  
  2. #include <avr/io.h>
  3.  
  4. void delaynew ();
  5. int main(void)
  6. {
  7.    DDRB = 0xFF; //PortB is set as o/p
  8.  
  9.   while (1)
  10.   {
  11.      PORTB = 0xAA;
  12.      delaynew();
  13.      PORTB = 0x55;
  14.      delaynew();
  15.   }
  16. }
  17.  
  18. void delaynew (void)
  19. {
  20.    TCCR0A =0xC2;...
Need assistaance with TIMER

Viewing all articles
Browse latest Browse all 4928

Trending Articles