I made this LED Blink project.
I made this LED Blink project with CrossWorks for AVR. It is working in hardware but I want to know whether the code is correct.
How to make a delay_ms() function which gives exact delays ?
[code]
#include <__cross_studio_io.h>
#include <inavr.h>
#include <avr.h>
#define CLK_FREQUENCY 4000000
int main(void)
{
DDRA = 0xCF;
DDRB = 0xFF;
DDRC = 0xFF;
DDRD = 0xFF;
PORTA = 0x00;
PORTB = 0x00;
PORTC = 0x00;
PORTD = 0x00;
while(1) {
PORTD = ~PORTD;
__delay_cycles(CLK_FREQUENCY);
}
debug_exit(0);
}
[/code]
Please sign in to leave a comment.
Comments
0 comments