hanukaran
Junior Member level 2
#include <mega32.h>
#include <delay.h>
#define red_1 PORTA.0
#define yellow_1 PORTA.1
#define green_1 PORTA.2
Void USART0_Init (unsigned short int F_CPU_Mhz, unsigned short int Baud_Rate)
{
USCR0B = 0x00;
USCR0A = 0x00;
UCSR0C = (1<<USBS0)|(1<<UCSZ01)|(1<<UCSZ00);
UBRR0L = ((8*1000000)/9600/16)-1;
UCSR0B = (1<<RXEN0)|(1<<TXEN0);
}
Void Send_Byte (char data)
{
While ((UCSR0A & (1<<UDRE0)) == 0);
UDR0 = data;
}
void main(void){
PORTA=0x00;
DDRA=0xFF;
PORTB=0x00;
DDRB=0x03;
PORTC=0x00;
DDRC=0xFF;
PORTD=0x00;
DDRD=0xFF;
while (1)
{
red_1=0;
green_1=1;
delay_ms(1500);
green_1=0;
yellow_1=1;
delay_ms(1500);
yellow_1=0;
red_1=1;
delay_ms(1500);
};
}
while(1)
{
If (red_1==0)
{
green_1=1;
Send_Byte('G');
}
If(green_1==0)
{
yellow_1=1;
Send_Byte('Y');
If (yellow_1==0)
{
red_1=1;
Send_Byte('R');
}}
the question is i attach the file...
#include <delay.h>
#define red_1 PORTA.0
#define yellow_1 PORTA.1
#define green_1 PORTA.2
Void USART0_Init (unsigned short int F_CPU_Mhz, unsigned short int Baud_Rate)
{
USCR0B = 0x00;
USCR0A = 0x00;
UCSR0C = (1<<USBS0)|(1<<UCSZ01)|(1<<UCSZ00);
UBRR0L = ((8*1000000)/9600/16)-1;
UCSR0B = (1<<RXEN0)|(1<<TXEN0);
}
Void Send_Byte (char data)
{
While ((UCSR0A & (1<<UDRE0)) == 0);
UDR0 = data;
}
void main(void){
PORTA=0x00;
DDRA=0xFF;
PORTB=0x00;
DDRB=0x03;
PORTC=0x00;
DDRC=0xFF;
PORTD=0x00;
DDRD=0xFF;
while (1)
{
red_1=0;
green_1=1;
delay_ms(1500);
green_1=0;
yellow_1=1;
delay_ms(1500);
yellow_1=0;
red_1=1;
delay_ms(1500);
};
}
while(1)
{
If (red_1==0)
{
green_1=1;
Send_Byte('G');
}
If(green_1==0)
{
yellow_1=1;
Send_Byte('Y');
If (yellow_1==0)
{
red_1=1;
Send_Byte('R');
}}
the question is i attach the file...