มินิโปรเจค

แสดงข้อความบน LCD







อุปกรณ์

1. LCD 
2. สวิตซ์
3. PIC16F877
4. R 10k  5 ตัว
5. VR 50k 
6. Crystal 4M
7. Capacitor 22p  2ตัว


CODE

char *text = " HELLO Teacher";
char *text1 = "How are you?";
void main() {
  TRISC = 0xFF;
  TRISB = 0;
  PORTC=0;
  Lcd_Init(&PORTB);         // Initialize LCD connected to PORTB
  Lcd_Cmd(Lcd_CLEAR);       // Clear display
  Lcd_Cmd(Lcd_CURSOR_OFF);  // Turn cursor off

  while(1)
  {
  RETURN:if(PORTC.F1==0)
  {
                 Lcd_Out(1, 2,             text);
                 while(PORTC.F1==0);
  }
    if(PORTC.F2==0)
             {
                 Lcd_Out(2, 5,             text1);
                 while(PORTC.F2==0);
             }
    if(PORTC.F3==0)
             {
              while(1)
                      {
                  Delay_ms(100);
                 Lcd_Out(1, 2,             text);
                 Lcd_Out(2, 5,             text1);
                     Lcd_Cmd(LCD_SHIFT_LEFT);
                       if(PORTC.F4==0)goto RETURN;
                       }
             }
      if(PORTC.F4==0)
             {
              while(1)
                      {
                      Delay_ms(100);
                 Lcd_Out(1, 2,             text);
                 Lcd_Out(2, 5,             text1);
                     Lcd_Cmd(LCD_SHIFT_RIGHT);
                      if(PORTC.F3==0)goto RETURN;
                       }
             }


  }
}




ความคิดเห็น

โพสต์ยอดนิยมจากบล็อกนี้

IC 13

DIY Arduino Traffic Light Pedestrian Light Push Button Control (https://thecustomizewindows.com/2016/06/diy-arduino-traffic-light-pae-push-button/)

Arduino Servo Motors (https://learn.adafruit.com/adafruit-arduino-lesson-14-servo-motors/arduino-code-for-sweep)