Winch
Member
One last thing... Just check the voltage getting to the display.. I'm wondering if its dropping out? The smaller one probably uses less current..
I also checked voltage is stable looks good.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
One last thing... Just check the voltage getting to the display.. I'm wondering if its dropping out? The smaller one probably uses less current..
Proc i2clcdbegin()
WaitMs 15 //// initial wait time for display
Call cmdwrite(0x33) /// These next two lines are a kind of pre-amble you MUST send 0x30 three times
WaitMs 5
Call cmdwrite(0x32) //
WaitMs 5
Call cmdwrite(0x2c) // LCD funtion set 4 bits and two lines.. ( there are always two lines.. They are address 0x80 <-> 0xAF and 0xC0 <-> 0xEF )
WaitMs 1 //
Call cmdwrite(0xc) // Display on
WaitMs 1
Call cmdwrite(0x6) // Incrementing
WaitMs 1
Call cmdwrite(0x1) /// Clear display and set position to first char
End Proc
Proc i2clcdbegin()
WaitMs 20
Call cmdwrite(0x33)
WaitMs 5
Call cmdwrite(0x32)
WaitMs 5
Call cmdwrite(0x2c)
WaitMs 1
Call cmdwrite(0xc)
WaitMs 1
Call cmdwrite(0x6)
WaitMs 1
Call cmdwrite(0x1)
End Proc
Proc cmdwrite(cmd As Byte)
Dim hi As Byte
Dim lo As Byte
lo = ShiftLeft(cmd, 4)
hi = cmd And 0xf0
lo = lo And 0xf0
cmd = hi + bl
I2CWrite sda, scl, 0x4e, cmd, cmd
cmd = cmd + 0x4
I2CWrite sda, scl, 0x4e, cmd, cmd
cmd = cmd - 0x4
I2CWrite sda, scl, 0x4e, cmd, cmd
WaitMs 5
cmd = lo + bl
I2CWrite sda, scl, 0x4e, cmd, cmd
cmd = cmd + 0x4
I2CWrite sda, scl, 0x4e, cmd, cmd
cmd = cmd - 0x4
I2CWrite sda, scl, 0x4e, cmd, cmd
End Proc
Proc i2clcdbegin()
WaitMs 20
I2CWrite sda, scl, 0x4e, 0x34, 0x34
WaitMs 1
I2CWrite sda, scl, 0x4e, 0x30, 0x30
WaitMs 5
I2CWrite sda, scl, 0x4e, 0x34, 0x34
WaitMs 1
I2CWrite sda, scl, 0x4e, 0x30, 0x30
WaitMs 5
I2CWrite sda, scl, 0x4e, 0x34, 0x34
WaitMs 1
I2CWrite sda, scl, 0x4e, 0x30, 0x30
WaitMs 5
Call cmdwrite(0x2c)
WaitMs 1
Call cmdwrite(0xc)
WaitMs 1
Call cmdwrite(0x6)
WaitMs 1
Call cmdwrite(0x1)
End Proc
Proc i2clcdbegin()
WaitMs 20 'wait time for display
I2CWrite sda, scl, 0x4e, 0x34, 0x34
WaitMs 1
I2CWrite sda, scl, 0x4e, 0x30, 0x30
WaitMs 5
I2CWrite sda, scl, 0x4e, 0x34, 0x34
WaitMs 1
I2CWrite sda, scl, 0x4e, 0x30, 0x30
WaitMs 5
I2CWrite sda, scl, 0x4e, 0x34, 0x34
WaitMs 1
I2CWrite sda, scl, 0x4e, 0x30, 0x30
'Call cmdwrite(0x33)
'WaitMs 5
'Call cmdwrite(0x32)
WaitMs 5
Call cmdwrite(0x2c) 'LCD function set 4 bits and two lines (there are always two lines.. They are adress 0x80 0xAF and 0xC0 0xEF)
WaitMs 1
Call cmdwrite(0xc) 'Display on
WaitMs 1
Call cmdwrite(0x6) 'Incrementing
WaitMs 1
Call cmdwrite(0x1) 'Clear display and set position to first character
End Proc
Call i2clcdbegin()
Call cmdwrite(0x80) '0x80 = 1e line
Call printstr1()
Call cmdwrite(0xc0) '0xc0 = 2e line
Call printstr2()
Call cmdwrite(0x94) '0x94 = 3e line
Call printstr3()
Call cmdwrite(0xd4) '0xd4 = 4e line
Call printstr4()
So the address of each line is 0x00,0x40,0x10,0x50. These numbers need the top bit added before being sent as a command.
Data sheet said that you must send three sets of 0x30 then the function command 0x2C.. but the command write has upper and lower so 0x33 is seen as two and then I usually send 0x32.. then finally 0x2C... For most displays this works..
Proc i2clcdbegin()
WaitMs 20 'wait time for display
Call cmdwrite(0x33) '33
WaitMs 5
Call cmdwrite(0x32) '32
WaitMs 1
Call cmdwrite(0x2c) 'LCD function set 4 bits and two lines (there are always two lines.. They are adress 0x80 0xAF and 0xC0 0xEF)
WaitMs 1
Call cmdwrite(0x0c) 'Display on/off control
WaitMs 1
Call cmdwrite(0x01) 'Clear display and set position to first character
WaitMs 1
Call cmdwrite(0x06) 'Incrementing
End Proc
dim str1 as string
str1 = "Testing = " + #data
call printstr( str1)
Proc printstr(str As String) // takes a string
Dim x As Byte
Dim ch As Byte
Dim idx As Byte
idx = Len(str) - 1 /// work out its size
For x = 0 To idx
ch = Asc(str) // grab the first character
Call datawrite(ch) // print it
str = LRotateStr(str) /// rotate so new character can be printed
Next x
End Proc