
SOLUTIONS CUBED
Electronics Prototyping, Custom Design, Product Development
Phone (530) 891-8045 256 East First Street
Fax (530) 891-1643 Chico, CA 95928
e-mail solcubed@solutions-cubed.com
Come visit our Web Site www.solutions-cubed.com
LCDwr:
OutC = Char.HIGHNIB ' Output high nibble
PULSOUT E, 1 ' Strobe the Enable line
OutC = Char.LOWNIB ' Output low nibble
PULSOUT E, 1
HIGH RS ' Return to character mode
RETURN
'*******************************************************************************************
' All display data is read from the operand1 and operand2 arrays. Operand2 represents the top line of
' the display. Operand1 represents the bottom line. Each byte in each array can store a value 0 - 15.
' The value represents a position in a lookup table, and the value from the lookup table is sent to the
' LCD. Characters are written to the LCD from top left to bottom right, and the entire LCD is refreshed
' each time this routine is called.
'
DisplayLCD:
Line1:
Char = $80 ' Display line one
GOSUB LCDcmd ' Initialize LCD
For Index = $00 to $07 ' Loop through positions 0 to 7 in Operand1 array
' Convert number in array to an ASCII character
LOOKUP Operand2(Index),["0","1","2","3","4","5","6","7","8","9","+","-","*","/","="," "],Char
GOSUB LCDwr ' Write ASCII character to LCD
Next
Line2:
Char = $C0 ' Display line two
GOSUB LCDcmd ' Re-Initialize LCD
For Index = $00 to $07 ' Loop through positions 0 to 7 in Operand1 array
' Convert number in array to an ASCII character
LOOKUP Operand1(Index),["0","1","2","3","4","5","6","7","8","9","+","-","*","/","="," "],Char
GOSUB LCDwr ' Write ASCII character to LCD
Next
RETURN
'*******************************************************************************************
' The Reset subroutine returns the MEMKey to it's initial settings. It also
' resets the LCD display values.
'
Reset:
SEROUT FM,Baud,[Default] ' Reset MEMKey to default settings
PAUSE 200
SEROUT FM,Baud,[PConfig,Config] ' Configure MEMKey for Polled Mode
PAUSE 15 ' Pause 10ms for EEPROM access
SEROUT FM,Baud,[PDBounce,DBounce] ' Program debounce value
PAUSE 15 ' Pause 10ms for EEPROM access
' Initialize MEMKey settings
For Index = $00 to $0F
LOOKUP
Index,[$00,$01,$02,$03,$04,$05,$06,$07,$08,$09,$0A,$0B,$0C,$0D,$0E,$0F],B_1
LOOKUP Index,["1","2","3","A","4","5","6","B","7","8","9","C","*","0","#","D"],B_2
SEROUT FM,Baud,[Pkeyval,B_1,B_2]
PAUSE 15