T6
Code Program
void main()
{
TRISB=0xFF;
TRISC=0;
Lcd_Init(&PORTC);
Lcd_Cmd(LCD_CURSOR_OFF);
Lcd_Cmd(LCD_CLEAR);
Lcd_Out(1,2," SMART LEARNING");
Lcd_Out(2,1," ADVANCE PIC BY C");
while(1)
{
RETURN:if(PORTB.F0==0)
{
Lcd_Cmd(LCD_SHIFT_RIGHT);
while(PORTB.F0==0);
}
if(PORTB.F1==0)
{
Lcd_Cmd(LCD_SHIFT_LEFT);
while(PORTB.F1==0);
}
if(PORTB.F2==0)
{
while(1)
{
Lcd_Cmd(LCD_SHIFT_RIGHT);
delay_ms(100);
if(PORTB.F0==0||PORTB.F1==0)goto RETURN;
}
}
}
}
void main()
{
TRISB=0xFF;
TRISC=0;
Lcd_Init(&PORTC);
Lcd_Cmd(LCD_CURSOR_OFF);
Lcd_Cmd(LCD_CLEAR);
Lcd_Out(1,2," SMART LEARNING");
Lcd_Out(2,1," ADVANCE PIC BY C");
while(1)
{
RETURN:if(PORTB.F0==0)
{
Lcd_Cmd(LCD_SHIFT_RIGHT);
while(PORTB.F0==0);
}
if(PORTB.F1==0)
{
Lcd_Cmd(LCD_SHIFT_LEFT);
while(PORTB.F1==0);
}
if(PORTB.F2==0)
{
while(1)
{
Lcd_Cmd(LCD_SHIFT_RIGHT);
delay_ms(100);
if(PORTB.F0==0||PORTB.F1==0)goto RETURN;
}
}
}
}
ภาพจำลองการทำงานด้วยโปรแกรม Proteus
ความคิดเห็น
แสดงความคิดเห็น