arduino lcd Data sheets and programs
'
'
'Thanks to westaust55 of the Picaxe forum for the LOOKUP command.
' now the program will work for 14M chips and above
' --- $01
' $10 | | $02
' $20 ---
' $40 | | $04
' $80 --- o $08 (Decimal point)
'
' All IC xx(yy)Pin numbers assume 40x1 pin Picaxe (28x1)
' + 5v lcd pin 1 IC 11 and IC 32
' 0v lcd pin 2 IC 12 and IC 31
Symbol nsck = 0 ' Output 0 lcd pin 3 IC 33(21)
Symbol si = 1' Output 1 lcd pin 4 IC 34(22)
Symbol cndata = 2 ' Output 2 lcd pin 5 IC 35(23) High = command low = data
Symbol nreset = 3 ' Output 3 lcd pin 6 IC 36(24) Low = reset
symbol nbus = pin0 ' Input 0 lcd pin 7 IC 20(11) Low = busy
Symbol ncs = 4 ' Output 4 lcd pin 8 IC 37(25) Low = Chip select
' Important!!! Vlc lcd pin 9 Pot(1k to 100K) wiper other pins are +5v and 0v
' Adjust until all 8's are displayed then turn back untill they just disappear.
' This will give maximum contrast.
'
Symbol _A = $77
Symbol _B = $F4
Symbol _C = $E0
Symbol _D = $E6
Symbol _E = $F1
Symbol _F = $71
Symbol _G = $D5
Symbol _H = $74
Symbol _I = $50
Symbol _J = $86
Symbol _K = $70
Symbol _L = $D0
Symbol _M = $76
Symbol _N = $64
Symbol _O = $E4
Symbol _P = $73
Symbol _Q = $DF
Symbol _R = $60
Symbol _S = $B5
Symbol _T = $51
Symbol _U = $C4
Symbol _V = $D6
Symbol _W = $F6
Symbol _X = $56
Symbol _Y = $72
Symbol _Z = $EB
Symbol _1 = $06
Symbol _2 = $E3
Symbol _3 = $A7
Symbol _4 = $36
Symbol _5 = $B5
Symbol _6 = $F4
Symbol _7 = $07
Symbol _8 = $F7
Symbol _9 = $37
Symbol _0 = $D7
Symbol _Mode = $40 'Mode 4 Div 1/3 bias 1/2^7
Symbol _USync = $30
Symbol _Sync = $31
Symbol _FBlink = $1B
Symbol _SBlink = $1A
Symbol _NoBlink= $18
Symbol _DisplayOn = $11
Symbol _Decode = $15 ' 7 seg decoder on
Symbol _NoDecode = $14' 7 seg decoder off
Symbol _LoadPointer = $E0 'Load data pointer lsb is location n*2 + 2 from right
Symbol DP1 = _LoadPointer + 2
Symbol _SetDP = $B8 ' Set DP at Load Pointer when using 7 seg decoder
Symbol _ClearDP = $97 ' Clear DP at Load Pointer
Symbol sbyte = b2 ' Serial data byte to be sent out sub Sendit
Symbol counter = b3
Symbol bitcount = b4
Symbol pos = b5
Symbol sbit = b6
' b13 Temp byte
' w4 Displayed Number
' w5 Temp for Displayed Number
' w6 Temp for Displayed Number
pause 1000
high nreset
high cndata
low ncs again:
' Set modes
FOR b13 = 0 to 6
LOOKUP b13, (_Mode,_USync,_NoBlink,_DisplayOn,_NoDecode,_ClearDp,_ClearDp), sbyte low ncs
GOSUB sendit
high ncs
NEXT b13 low ncs justdata:
' send initial text high ncs
low cndata ' set to data mode
low ncs FOR b13 = 11 to 0 step -1
LOOKUP b13,(_S,_P,_E,_E,_D,_0,_0,_0,_0,_R,_P,_S),SBYTE
GOSUB sendit
NEXT b13
' setup to send numeric data w4=0
high ncs
High cndata
sbyte = _Decode 'Turn decoder on
Low ncs
GOSUB sendit
high ncs Countup:
high cndata
low ncs
w4=w4+1 'Point to lsb number
sbyte= _LoadPointer + 6 'Point to 4th digit from right
GOSUB sendit
low cndata
'parse number and sendit
w5=w4/10
w5=w5*10
sbyte = w4-w5
GOSUB sendit
w6 = w4 / 10
w5 = w4/100 *10
sbyte = w6-w5
GOSUB sendit
w6 = w4 / 100
w5 = w4 / 1000 * 10
sbyte = w6-w5
GOSUB sendit
w6 = w4 / 1000
w5 = w4 / 10000 * 10
sbyte = w6-w5
GOSUB sendit 'Set Decimal point
high ncs 'Command mode
low ncs 'select chip
FOR b5 = 0 to 3
lookup b5,(_NoDecode,DP1,_SetDP,_Decode), sbyte
GOSUB sendit
Next b5
High ncs 'execute the commands and see the dp goto countup
Endloop:
pos = pos
goto Endloop
sendit:
' assume ncs low and cndata set busy: ' Check if last command processed
if nbus = 0 then goto busy ' only important if using assembly bitcount = 128
For counter = 1 to 8
low nsck
sbit = bitcount & sbyte
if sbit = 0 then 'bit out
low si
else
high si
end if
bitcount = bitcount / 2 ' point to next bit
high nsck
next counter
return