Advertisement
Guest User

Untitled

a guest
Dec 27th, 2020
3,457
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.48 KB | None | 0 0
  1. #define _XTAL_FREQ 8000000
  2.  
  3. #define RS RD2
  4. #define EN RD3
  5. #define D4 RD4
  6. #define D5 RD5
  7. #define D6 RD6
  8. #define D7 RD7
  9.  
  10. #include <xc.h>
  11. #include "lcd.h";
  12.  
  13. // BEGIN CONFIG
  14. #pragma config FOSC = HS // Oscillator Selection bits (HS oscillator)
  15. #pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT enabled)
  16. #pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled)
  17. #pragma config BOREN = ON // Brown-out Reset Enable bit (BOR enabled)
  18. #pragma config LVP = OFF // Low-Voltage (Single-Supply) In-Circuit Serial Programming Enable bit (RB3 is digital I/O, HV on MCLR must be used for programming)
  19. #pragma config CPD = OFF // Data EEPROM Memory Code Protection bit (Data EEPROM code protection off)
  20. #pragma config WRT = OFF // Flash Program Memory Write Enable bits (Write protection off; all program memory may be written to by EECON control)
  21. #pragma config CP = OFF // Flash Program Memory Code Protection bit (Code protection off)
  22. //END CONFIG
  23.  
  24. int main()
  25. {
  26.     unsigned int a;
  27.     TRISD = 0x00;
  28.     Lcd_Init();
  29.     while(1)
  30.     {
  31.         Lcd_Clear();
  32.         Lcd_Set_Cursor(1,1);
  33.         Lcd_Write_String("Thundertronics");
  34.         Lcd_Set_Cursor(2,1);
  35.         Lcd_Write_String("electronics blog");
  36.         __delay_ms(3000);
  37.         Lcd_Clear();
  38.         Lcd_Set_Cursor(1,1);
  39.         Lcd_Write_String("Welcome to");
  40.         Lcd_Set_Cursor(2,1);
  41.         Lcd_Write_String("PIC MCU course");
  42.         __delay_ms(3000);
  43.        
  44.  
  45.        
  46.  
  47.     }
  48.     return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement