วันศุกร์ที่ 8 กุมภาพันธ์ พ.ศ. 2562

T11

งาน11

void timer0_setup()
{
T0CON.TMR0ON=0;
INTCON.TMR0IF=0;
TMR0H=0xC2;
TMR0L=0xF7;
T0CON.TMR0ON=1;
}

void main()
{
TRISC=0;
TRISD=0xFF;
T0CON=0x05;
Lcd_Init(&PORTC);
Keypad_Init(&PORTD);
Lcd_Cmd(LCD_CURSOR_OFF);
Lcd_Cmd(LCD_CLEAR);
Lcd_Chr(1,1,'3');
timer0_setup();
while(INTCON.TMR0IF==0)
{
if(Keypad_Read()==3)
{
Lcd_Chr(1,1,' ');
break;
}
}
Lcd_Chr(2,5,'6');
timer0_setup();
while(INTCON.TMR0IF==0)
{
if(Keypad_Read()==7)
{
Lcd_Chr(2,5,' ');
break;
}
}
Lcd_Chr(1,9,'8');
timer0_setup();
while(INTCON.TMR0IF==0)
{
if(Keypad_Read()==10)
{
Lcd_Chr(1,9,' ');
break;
}
}
Lcd_Chr(2,16,'0');
timer0_setup();
while(INTCON.TMR0IF==0)
{
if(Keypad_Read()==14)
{
Lcd_Chr(2,16,' ');
break;
}
}
Lcd_Chr(2,1,'7');
timer0_setup();
while(INTCON.TMR0IF==0)
{
if(Keypad_Read()==9)
{
Lcd_Chr(2,1,' ');
break;
}
}
Lcd_Chr(1,12,'4');
timer0_setup();
while(INTCON.TMR0IF==0)
{
if(Keypad_Read()==5)
{
Lcd_Chr(1,12,' ');
break;
}
}
Lcd_Chr(2,9,'1');
timer0_setup();
while(INTCON.TMR0IF==0)
{
if(Keypad_Read()==1)
{
Lcd_Chr(2,9,' ');
break;
}
}
Lcd_Chr(1,16,'5');
timer0_setup();
while(INTCON.TMR0IF==0)
{
if(Keypad_Read()==6)
{
Lcd_Chr(1,16,' ');
break;
}
}
Lcd_Chr(1,5,'9');
timer0_setup();
while(INTCON.TMR0IF==0)
{
if(Keypad_Read()==11)
{
Lcd_Chr(1,5,' ');
break;
}
}
Lcd_Chr(2,12,'2');
timer0_setup();
while(INTCON.TMR0IF==0)
{
if(Keypad_Read()==2)
{
Lcd_Chr(1,12,' ');
break;
}
}
}
รูปภาพ

ไม่มีความคิดเห็น:

แสดงความคิดเห็น