View previous topic :: View next topic |
Author |
Message |
Paulvk
Joined: 28 Jul 2006 Posts: 1257 Location: SYDNEY
|
Posted: Sun Jul 03, 2016 8:48 am Post subject: |
|
|
I ordered another I2C LCD board and attached it to another LCD
they both work you can switch between them
This means you could have 8 LCDs on the bus all displaying different data
You only need to change the I2C address the code to display the data can be used for all displays
Now all we need is a library to drive the low cost 64 x 128 type LCDs via I2C using 2 PCF8574
Regards Paul |
|
Back to top |
|
|
bzijlstra
Joined: 30 Dec 2004 Posts: 1179 Location: Tilburg - Netherlands
|
Posted: Sun Jul 03, 2016 2:29 pm Post subject: Busy... |
|
|
Sorry Paul, promised to test, was a bit to busy with MQTT. Nice to hear it is working.
Have fun
Ben Zijlstra |
|
Back to top |
|
|
Paulvk
Joined: 28 Jul 2006 Posts: 1257 Location: SYDNEY
|
Posted: Mon Jul 04, 2016 10:28 am Post subject: |
|
|
That's ok Ben there are only so many hours in the day
I have now tested the BIG character routines and they also work
still need the home though
Regards Paul |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Mon Apr 03, 2017 2:43 pm Post subject: |
|
|
really amazing. Smart programming of the text LCD. I like it _________________ Mark |
|
Back to top |
|
|
EDC
Joined: 26 Mar 2014 Posts: 971
|
Posted: Mon Apr 03, 2017 2:50 pm Post subject: |
|
|
In the truth the shag - poaching horse, is from Bascom application notes (one made by Radan) LINK
I only make this video to show someone else on polish forum that this is really easy to achieve
And also post it here because used library is from this topic.
Finally i was think that show simple "Hello world" will not be interesting as this horse is I think hahaha |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Mon Apr 03, 2017 3:06 pm Post subject: |
|
|
thanks for pointing that out. I knew about clever programming of LCD. But i forgot about this AN. I had no idea that it would look that good.
A video makes all the difference. _________________ Mark |
|
Back to top |
|
|
pippofranco
Joined: 02 Oct 2010 Posts: 6
|
Posted: Tue Apr 11, 2017 6:35 pm Post subject: |
|
|
I am also out of pins and wanted to try the I2C LCD controller
I use this simple code
Code: |
$regfile = "m328pdef.dat"
$crystal = 8000000
$baud = 57600
$hwstack = 100 ' default use 32 for the hardware stack
$swstack = 100 'default use 10 for the SW stack
$framesize = 100 'default use 40 for the frame space
Config I2cdelay = 40
$lib "bl_Lcd_i2c.lib" ' AN #118 library from Kent
Backlight_on Alias &H08
Backlight_off Alias &H00
Const Pcf_d4 = 4
Const Pcf_d5 = 5
Const Pcf_d6 = 6
Const Pcf_d7 = 7
Const Pcf_rs = 0
Const Pcf_rw = 1
Const Pcf_e1 = 2
Dim B As Byte
Dim A As Byte
Dim _lcd_e As Byte
Dim Backlight As Byte
_lcd_e = 128
Const Pcf8574_lcd = &H7E 'Defines the address of the I/O expander for LCD
Config Scl = Portd.3 'Is serial clock SCL
Config Sda = Portd.4
'=======================================
'without this you get rubbish on LCD at power up
Home
'=======================================
Locate 1 , 1
Lcd "Test Line 1"
Locate 2 , 1
Lcd "Test Line 2"
End
|
At compile time I get the following errors:
Error : 46 Line : 45 Assignment error, unknown variable (DIM) [LCD_BACKLIGHT: 0 1: 112]
Error : 5 Line : 45 No more space for BIT [LCD_BACKLIGHT]
Error : 320 Line : 45 [syntax error, token = '{']
The bl_Lcd_i2c.lib library is in the lib directory of Bascom
What am I doing wrong? |
|
Back to top |
|
|
bzijlstra
Joined: 30 Dec 2004 Posts: 1179 Location: Tilburg - Netherlands
|
Posted: Tue Apr 11, 2017 9:52 pm Post subject: Some questions about i2c LCD |
|
|
In the first item of this thread there is also an example with the atmega328p. On an Arduino Nano. Only the addrress on the I2c bus is different. &H4E instead of &H7E. I see, when I compare this example with your example that you mis a library.
I also see 172 downloads but don't see that many complaints.
So the example should work with perhaps some remarks of PaulVK.
How did you manage to get the i2c address of your lcd-module? Did you use the i2c scan option? Are the config statements for slk and sda correct?
The library is pure ASCII do you see any variable with the name LCD_BACKLIGHT? I am not on a PC right now.
Have fun
Ben Zijlstra |
|
Back to top |
|
|
pippofranco
Joined: 02 Oct 2010 Posts: 6
|
|
Back to top |
|
|
bzijlstra
Joined: 30 Dec 2004 Posts: 1179 Location: Tilburg - Netherlands
|
Posted: Tue Apr 11, 2017 11:42 pm Post subject: Still missing a $lib |
|
|
Still missing the second $lib call compared to the first example in the tread.
And what about $hwstack, $swstack and $framesize. You must be using an old Bascom-AVR version.
Have fun
Ben Zijlstra |
|
Back to top |
|
|
pippofranco
Joined: 02 Oct 2010 Posts: 6
|
Posted: Wed Apr 12, 2017 2:22 am Post subject: |
|
|
If you mean
$lib "i2c_twi.lib"
I use software TWI, I shouldn't need it
$hwstack, $swstack and $framesize: I haven't understood yet how to set them up but eventually I will learn
I am using Bascom 2.0.7.8 |
|
Back to top |
|
|
bzijlstra
Joined: 30 Dec 2004 Posts: 1179 Location: Tilburg - Netherlands
|
Posted: Wed Apr 12, 2017 6:44 am Post subject: Some things missing |
|
|
I hope you understand that the
Backlight_on= &h08
Backlight_off = &h00
Are aliases. It shall be OR'ed with what should go on the in-output pins of the PCF8574 on the small PCB. &h08 will put a 1 in the 4th pin of the PCF8574.
I see no
Backlight = Backlight_on
or
Backlight = Backlight_off
Some LCD command should trigger going to the library so perhaps you can add CLS to your two LCD commands.
If you don't fill backlight it will stay 0 and your backlight will stay off.
Could you give it a try?
Ben Zijlstra |
|
Back to top |
|
|
pippofranco
Joined: 02 Oct 2010 Posts: 6
|
Posted: Wed Apr 12, 2017 8:42 am Post subject: |
|
|
I managed to get it running:
I modified the line :
Dim Backlight As Byte into Dim Lcd_backlight As Byte
and solved the 3 errors
got rid of
Backlight_on Alias &H08
Backlight_off Alias &H00
as Lcd_backlight accepts 0 or 1
(&H08 is actually the value to write to the Pcf8574 to turn on/off the backilight)
Not needed but added Const Pcf_e2 = 3
Code: |
$regfile = "M328pdef.dat" ' the used chip
$crystal = 8000000 ' frequency used
$lib "bl_Lcd_i2c.lib"
Const Pcf_d4 = 4
Const Pcf_d5 = 5
Const Pcf_d6 = 6
Const Pcf_d7 = 7
Const Pcf_rs = 0
Const Pcf_rw = 1
Const Pcf_e1 = 2
Const Pcf_e2 = 3
Dim A As Byte
Dim _lcd_e As Byte
Dim Lcd_backlight As Byte
_lcd_e = 128
Const Pcf8574_lcd = &H7E
Config Scl = Portd.3
Config Sda = Portd.4
Config I2cdelay = 10
I2cinit
Waitms 100
Lcd_backlight = 1
Cls
Home
Lcd "i2c-display"
For A = 0 To 10
Lcd_backlight = 1
Locate 2 , 1
Lcd A
Waitms 800
Lcd_backlight = 0
Locate 2 , 1
Lcd " "
Waitms 800
Next
Lcd_backlight = 1
Locate 2 , 1
Lcd "End"
End
|
Thank you for the help
Regards,
PF |
|
Back to top |
|
|
|