T18
void main()
{
unsigned char segment[]= {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
unsigned char step[]={0x01,0x02,0x04,0x08};
unsigned char i,j;
TRISB=0;
TRISC=0;
PORTB=segment[0];
while(1)
{
for(i=0;i<4;i++)
{
PORTC=step[i];
delay_ms(500);
}
j++;
PORTB=segment[j];
if(j>8)
{
while(1)PORTC=0x00;
}
}
}V
ความคิดเห็น
แสดงความคิดเห็น