Hi Everyone,
It seems as if, . . . the LCD serial backpack device must be the
Crown Jewels, of PICdome as I have been unable to wrestle suitable
code out of the internet. Posted below is a modified version of some code
I found somewhere, probably for a BS1, anyway I tweaked it some and it works after a fashion, but I think it needs something in the way of a buffer
and some code to make changes on the fly, like does the cursor blink or not
etc. . . I think it would be way cool to fashion a workable public domain
serial unit, so newbies and non-newbies have access without forking up $35 bucks for a serial LCD.
Anyone up to the challange? As I have been coding PIC micros only since 08/06, My coding skills are not there yet, but thanks to you all I am learning.
Joe
Code:@ DEVICE pic16F628A, HS_OSC @ DEVICE pic16F628A, WDT_ON ' Watchdog Timer @ DEVICE pic16F628A, PWRT_ON ' Power-On Timer @ DEVICE pic16F628A, MCLR_ON ' Master Clear Options (Internal) @ DEVICE pic16F628A, BOD_OFF ' Brown-Out Detect @ DEVICE pic16F628A, LVP_OFF ' Low-Voltage Programming @ DEVICE pic16F628A, CPD_OFF ' Data Memory Code Protect ' Set to CPD_OFF for Development Copy ' Set to CPD_ON for Release Copy @ DEVICE pic16F628A, PROTECT_OFF ' Program Code Protection ' Set to PROTECT_OFF for Development Copy ' Set to PROTECT_ON for Release Copy trisb = %00000001 trisA = %11110011 include "modedefs.bas" ' Define LCD registers and bits Define LCD_DREG PORTB Define LCD_DBIT 4 Define LCD_RSREG PORTB Define LCD_RSBIT 2 Define LCD_EREG PORTB Define LCD_EBIT 3 DEFINE LCD_LINES 4 'Define using a 2 line LCD DEFINE LCD_COMMANDUS 2000 'Define delay time between sending LCD commands DEFINE LCD_DATAUS 50 'Define delay time between data sent. DEFINE OSC 20 char Var byte ' Storage for serial character CMCON = 7 ' PORTA is digital Pause 100 ' Wait for LCD to startup high PortA.2 ' power for backlight low PortA.3 ' backlight ground main: Lcdout $FE, 1 ' Initialize and clear display LCDOUT $FE, $0C LCDOUT "My Flash Text" pause 800 Lcdout $FE, 1,$FE, 2 goto loop loop: Serin PORTB.1,N9600,char ' Get a char from serial input Lcdout char ' Send char to display Goto loop ' Do it all over again End




Bookmarks