Anda di halaman 1dari 2

#include<mega32.

h>
#include<delay.h>
unsigned int bjl;
unsigned char lpl;
unsigned char bil[11]={0x00,0xc0,0xfd,0xa4,0xb0,0xdd,0xd2,0x82,0xf8,0x80,0xd0};
void main(void){
DDRA=DDRB=DDRC=DDRD=255;
PORTA=PORTB=PORTC=PORTD=0;
while(1)
{
PORTC=0X41;
PORTD=0X44;
for(lpl=3; lpl>0; lpl--)
{
delay=ms(1);
for (bjl=0; bjl<10; bjl++)
{
PORTB=0x0d;
PORTA=bil[lpl];
delay_ms(10);
PORTB=0x20;
PORTA=bil[lpl+3];
delay_ms(10);
PORTB=0x80;
PORTA=bil(lpl+6);
delay_ms(10);
if(lpl==1)
{
PORTC=0x42;
PORTD=0x44;
PORTB=0x04;
PORTA=0xff;
delay_ms(10);
}
}
}
PORTC=0x14;
for(lpl=3; lpl>0; lpl--)
{
delay_ms(1);
for(bjl=0; bjl<10; bjl++)
{
PORTB=0x24;
PORTA=bil[lpl];
delay_ms(10);
PORTB=0x80;
PORTA=bil[lpl+3];
delay_ms(10);
PORTB=0x02;
PORTA=bil[lpl+6];
delay_ms(10);
if(lpl==1)
{
PORTC=0x24;
PORTD=0x44;
PORTB=0x04;
PORTA=0xff;
delay_ms(10);

}
}
}
PORTC=0x44;
PORTD=0x41;
for(lpl=3; lpl>0; lpl--)
{
delay_ms(1);
for(bjl=0; bjl<10; bjl++)
{
PORTB=0xd0;
PORTA=bil[lpl];
delay_ms(10);
PORTB=bil[lpl+3];
delay_ms(10);
PORTB=0x08;
PORTA=bil[lpl+6];
delay_ms(10);
if(lpl==1)
{
PORTD=0x42;
PORTB=0x04;
PORTA=0xff;
delay+ms(10);
}
}
}
PORTD=0x14;
for(lpl=3; lpl>0; lpl--)
{
delay_ms(1);
for(bjl=0; bjl<10; bjl++)
{
PORTB=0x42;
PORTA=bil[lpl];
delay_ms(10);
PORTB=0x08;
PORTA=bil[lpl+3];
delay_ms(10);
PORTB=0x20;
PORTA=bil[lpl+6]
delay_ms(10);
if(lpl==1)
{
PORTD=0x24;
PORTB=0x04;
PORTA=0xff;
delay_ms(10);
}
}
}
}
}