You are hereProjects / LCD Controller
LCD Controller
Built an LCD(ATM2004D, HD44780 compatible) Controller using a PIC 16F628, more info to come..
R4 should/could be a potentiometer but fixed 1.8k gave me the backlight I wanted.
Conn1 = LCD
Conn2=ICP
Conn3=Serial
PicBasic Pro code that runs the display, this piece of code waits for a 00000001 on port B4 before sending the given "status" to the display, needs some cleaning but it should give a pretty good idea of how to communicate to the LCD.
@ __CONFIG _INTRC_OSC_NOCLKOUT & _WDT_ON & _PWRTE_ON & _MCLRE_ON & _LVP_OFF & _BODEN_ON
Include "modedefs.bas"
DEFINE LCD_LINES 4
row var byte[20]
i var word
INDATA var BYTE
TRISB.4=1 'b4 as input
Pause 500 ' Wait for LCD to startup
LCDOUT $FE,1,"Waiting for command."
start:
Serin2 PORTB.4, 16572,1500,nothing,[BIN8 INDATA]
pause 100
indataHandler:
SELECT CASE INDATA CASE %00000001
row[1] = "R"
row[2] = "u"
row[3] = "n"
row[4] = "n"
row[5] = "i"
row[6] = "n"
row[7] = "g"
row[8] = 0
END SELECT
goto lcdwrite
Goto start
nothing:
goto start lcdwrite:
LCDOUT $FE,1,"Status="
for i = 1 to 20 step 1
if row[i]=0 then
goto endrow1
endif
lcdout row[i]
next i
endrow1:
lcdout $fe,$c0,"Function="
lcdout $fe,$94,"null"
lcdout $fe,$d4,"null"
Pause 1000 ' Wait .5 second
'goto start
| Attachment | Size |
|---|---|
| lcd controller.png | 28.18 KB |
| lcd controller.vsd | 458.5 KB |
| Stencil4.vss | 87.5 KB |
Post new comment