for my money i would let pbp do all the heavy lifting and leverage their nice efficent routines like this
works for 4 or 8 bit mode and all
ps forgot to add it is now so easy to add a flash screen on bootCode:'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' 'Name : 16F690 LCD BACKPACK ' Date : oct 2025 richard ' Note : 300 words used of 2048 ' Notes : Serin2 Baud Rate 300 ~ 19200 Intrc_OSC 8Mhz ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' #CONFIG cfg = _INTRC_OSC_NOCLKOUT cfg&= _WDT_OFF cfg&= _PWRTE_OFF cfg&= _MCLRE_OFF cfg&= _CP_OFF cfg&= _CPD_OFF cfg&= _BOD_OFF cfg&= _IESO_OFF cfg&= _FCMEN_OFF __CONFIG cfg #ENDCONFIG DEFINE OSC 8 ANSEL = 0 ' Set all pins digital ANSELH = 0 ' Set all pins digital OPTION_REG.7 = 0 ' PORTA/PORTB pull-ups are enabled by individual port latch values CLEAR DEFINE LCD_BITS 8 'defines the number of data interface lines (4 or 8) DEFINE LCD_DREG PORTC 'defines the port where data lines are connected to DEFINE LCD_RSREG PORTB 'defines the port where RS line is connected to DEFINE LCD_RSBIT 6 'defines the pin where RS line is connected to DEFINE LCD_EREG PORTB 'defines the port where E line is connected to DEFINE LCD_EBIT 4 'defines the pin where E line is connected DEFINE LCD_COMMANDUS 1500 'defines the delay after LCDOUT statement DEFINE LCD_DATAUS 50 'delay in micro seconds B1 var byte Bl var byte ' 300=3313 600=1646 1200=813 2400=396 4800=188 9600=84 19200=32 BaudR var byte : baudr = 32 TRISC = 0 TRISA = % 11111110 OSCCON = $70 PAUSE 500 Porta.0 = 1 ' Backlight ON LCDOUT $FE,1 ' LCDOUT "ready @19200" @ bsf LCD_RSREG ,LCD_RSBIT main: serin2 Portb.5,baudr,3,main,[b1] if bl then if b1 = 0 then porta.0 = 0 ' Back Light OFF endif if b1 = 8 then porta.0 = 1 ' Back Light ON endif bl = 0 goto main endif if b1 = 255 then bl = 1 goto main endif if b1 = 254 then @ bcf LCD_RSREG ,LCD_RSBIT goto main endif @ MOVE?BB _B1,R3 @ L?CALL lcdsend @ bsf LCD_RSREG ,LCD_RSBIT goto main ' loop back to top


Reply With Quote

Bookmarks