Mar 22, 2006 #1 D david90 Advanced Member level 1 Joined May 5, 2004 Messages 423 Helped 9 Reputation 18 Reaction score 4 Trophy points 1,298 Activity points 3,611 Code: #include <avr/io.h> #include <uart.h> #include <delay.h> #define BAUDRATE 19200 #define xtalCpu 8000000 int main(void) { DDRB=0xFF; uart_init(19200); while(1) { //uart_putc('U'); _delay_ms(5000); PORTB=0xFF; _delay_ms(5000); NutSleep=0x0; _delay_ms(500); } return 0; } For some reason, my LED blinks way faster than 5sec. Is there anything wrong with my code?
Code: #include <avr/io.h> #include <uart.h> #include <delay.h> #define BAUDRATE 19200 #define xtalCpu 8000000 int main(void) { DDRB=0xFF; uart_init(19200); while(1) { //uart_putc('U'); _delay_ms(5000); PORTB=0xFF; _delay_ms(5000); NutSleep=0x0; _delay_ms(500); } return 0; } For some reason, my LED blinks way faster than 5sec. Is there anything wrong with my code?
Mar 22, 2006 #2 S suryakant Member level 5 Joined Mar 10, 2005 Messages 90 Helped 6 Reputation 12 Reaction score 0 Trophy points 1,286 Location India Activity points 2,171 Are they blinking at all? where are u making PORTB = 0x00; ???? what is this?????? Code: NutSleep=0x0; Also check for watchdog
Are they blinking at all? where are u making PORTB = 0x00; ???? what is this?????? Code: NutSleep=0x0; Also check for watchdog
Mar 22, 2006 #3 N necromancer Member level 1 Joined Jan 5, 2005 Messages 33 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,286 Activity points 222 you must use PORTB ^= 0xFF; instead
Mar 22, 2006 #4 D david90 Advanced Member level 1 Joined May 5, 2004 Messages 423 Helped 9 Reputation 18 Reaction score 4 Trophy points 1,298 Activity points 3,611 it is blinking(i can see) but just too fast. ignore "NutSleep=0x0;" I forgot to take it out.