' Name : LCDINX.pbp ' Compiler : PICBASIC PRO Compiler 2.6 ' Assembler : PM or MPASM ' Target PIC : 40-pin 16F877A, 18F452 or similar ' Hardware : LAB-X1 Experimenter Board ' Oscillator : 4MHz external crystal ' Keywords : LCDIN, LCDOUT ' Description : PICBASIC PRO program to display "hello world" on LCD, ' then use LCDIN to read the first letter of each line and change it ' to upper case. ' ' Define LOADER_USED to allow use of the boot loader. ' This will not affect normal program operation. Define LOADER_USED 1 ' Define LCD registers and bits Define LCD_DREG PORTD Define LCD_DBIT 4 Define LCD_RSREG PORTE Define LCD_RSBIT 0 Define LCD_EREG PORTE Define LCD_EBIT 1 Define LCD_RWREG PORTE Define LCD_RWBIT 2 character VAR BYTE ADCON1 = 7 ' Set PORTA and PORTE to digital Low PORTE.2 ' LCD R/W line low (W) Pause 100 ' Wait for LCD to start up mainloop: LCDOut $FE, 1 ' Clear screen Pause 500 ' Wait .5 second LCDOut "hello" ' Display "hello" Pause 500 ' Wait .5 second LCDOut $fe, $C0, "world" ' Move to line 2 and display "world" Pause 500 ' Wait .5 second LCDIN $80, [character] ' Read value of first character, first line LCDOut $FE, $80, (character - $20) ' Change character to upper case Pause 500 ' Wait .5 second LCDIN $C0, [character] ' Read value of first character, second line LCDOut $FE, $C0, (character - $20) ' Change character to upper case Pause 500 ' Wait .5 second GoTo mainloop ' Do it forever End