electronicslab
Junior Member level 3
atmega32 use the led animation
https://img246.imageshack.us/i/avr.jpg/
The led is off all the time.Don't know why.
Someone please help.
https://img246.imageshack.us/i/avr.jpg/
The led is off all the time.Don't know why.
Someone please help.
Code:
#include <avr/io.h>
/// Typedefs //////////
typedef unsigned char u8;
typedef unsigned int u16;
typedef unsigned long u32;
/// Defines ///////////
#define forever 117
#define LEDOFF PORTB |= (1<<4)
#define LEDON PORTB &= ~(1<<4)
/// Prototypes ////////
void InitPorts (void);
void Delay (u32 count);
int main(void)
{
InitPorts();
while (forever)
{
LEDON;
Delay(20000);
LEDOFF;
Delay(20000);
}
}
void InitPorts(void)
{
//DDRB |= 1<<DDB4;
DDRB=0xFF;
}
void Delay(u32 count)
{
while(count--);
}