View previous topic :: View next topic |
Author |
Message |
MHz
Joined: 28 Sep 2007 Posts: 123
|
Posted: Fri Feb 27, 2015 5:04 pm Post subject: spc(i): LCD with I2C converter failed |
|
|
After changing the LCD connection from prallel to I2C with this line of code:
Lcd Spc(fill) 'fill rest of LCD line with blank
the processor get stuck *). However all other LCD commands works fine. Here are the initial settings:
$regfile = "m328pdef.dat"
$crystal = 16000000
$lib "YwRobot_Lcd_i2c.lib" 'YwRobot Treiber für LCD
$hwstack = 64
$swstack = 10
$framesize = 40
Config I2cdelay = 1
Const Pcf8574_lcd = &H4E 'Defines the address of the I/O expander for LCD
Config Scl = Portd.6 'Configure i2c SCL
Config Sda = Portd.7 'Configure i2c SDA
Dim _lcd_e As Byte 'Needed to control 4 line LCD
Dim Lcd_backlight As Byte 'Returned Key from _Key_scan
perplexed
MHz
*) this is my persoal point of view
(BASCOM-AVR version : 2.0.7.8 ) |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Fri Feb 27, 2015 9:40 pm Post subject: |
|
|
you are using this : $lib "YwRobot_Lcd_i2c.lib" 'YwRobot Treiber für LCD
Which is NOT a library from MCS/BASCOM. So you need to ask the writer or send it.
spc() loads R16 with the number of spaces, and calls the write character routine with a value if 32 in R24 to send a space.
My guess is that the lib alters R16. _________________ Mark |
|
Back to top |
|
|
MHz
Joined: 28 Sep 2007 Posts: 123
|
Posted: Fri Feb 27, 2015 10:32 pm Post subject: |
|
|
Thank you Mark for fast reply.
Employing I2C converter/adapter for driving LCD's save precious pins and is - thanks very cheap chineese modules - in common use. Maybe you self use them
So the question is why do we have to use third party libs? Isn't it worth to think about a MCS Electronics supported / developed lib? Once again, I2C adapters for LCD's are widely used.
Best regards |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Fri Feb 27, 2015 10:50 pm Post subject: |
|
|
no that was not the question! That is a new question. You could have better included the lib.
But to answer that : there is already a lib provided. It is named Lcd_RX1602A5. It is for an i2c LCD.
It might not be suited for your LCD but in China there are 1001 different LCD's. It is impossible to write a driver for all of them.
We only include drivers for the most popular LCD's. And that means that there need to be multiple support requests.
We also write custom drivers for a fee. Some of them may be shared and end up in bascom too. _________________ Mark |
|
Back to top |
|
|
kimmi
Joined: 24 Feb 2006 Posts: 1922 Location: Denmark
|
Posted: Sat Feb 28, 2015 1:17 am Post subject: |
|
|
A bit more info how to use the lib here
I2C-LCD von YwRobot web
It use both R16 & R24
addon file : BASCOM-Library for YwRobot-I2C-LCD (Version 2) By Kent Andersson _________________ / Kim |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Sat Feb 28, 2015 12:03 pm Post subject: |
|
|
it is best to replace R16 by R22. That should solve it. _________________ Mark |
|
Back to top |
|
|
Yenary
Joined: 19 May 2009 Posts: 3 Location: Yogyakarta
|
Posted: Sun Sep 27, 2015 10:14 am Post subject: me fail |
|
|
[quote="albertsm"]it is best to replace R16 by R22. That should solve it.[/quote]
I try and try but still cant. i use atmega8. here my code.
$regfile = "m8def.dat" 'website micro is Attiny2313
$crystal = 11059200 'website crystal is 4 MHz
$lib "YwRobot_Lcd_i2c.lib" 'YwRobot Treiber für LCD
$hwstack = 64
$swstack = 10
$framesize = 40
'**********************************************************
'******************* Deklarationen ************************
Const Pcf8574_lcd = &H4E 'Adresse des I2C-LCDs
Dim Lcd_backlight As Byte '1 = an; 0 = aus. Wird erst durch einen LCD-Befehl umgesetzt!
'****************** Initialisierung ***********************
Config Scl = Portc.5 'Konfigurieren von I2C
Config Sda = Portc.4
Config Lcd = 16 * 2 'nicht unbedingt nötig
Config I2cdelay = 1
Waitms 300 'warte bis Kondensator bei Ta0 geladen, auch für LCD-Init!
'**********************************************************
'******************** Hauptprogramm ***********************
Cls
Lcd "Hello world!"
Wait 1
Lcd_backlight = 0
Locate 2 , 1
Lcd "2. row..."
Wait 2
Lcd_backlight = 1
Locate 1 , 1 'Damit Backlight-Zustand an LCD übermittelt wird
End _________________ Stephen Mahago |
|
Back to top |
|
|
bzijlstra
Joined: 30 Dec 2004 Posts: 1179 Location: Tilburg - Netherlands
|
Posted: Sun Sep 27, 2015 10:26 am Post subject: i2c lcd driver |
|
|
In the Bascom-Arduino section there is also an example with the library of Kent. Also with a small modification for the backlight.
Have fun
Ben Zijlstra |
|
Back to top |
|
|
Yenary
Joined: 19 May 2009 Posts: 3 Location: Yogyakarta
|
Posted: Mon Sep 28, 2015 7:12 am Post subject: Re: i2c lcd driver |
|
|
bzijlstra wrote: | In the Bascom-Arduino section there is also an example with the library of Kent. Also with a small modification for the backlight.
Have fun
Ben Zijlstra |
Can you provide me the link? I already try kent library. and i already try g-heinrichs.de library too. still cant.
Thank you. _________________ Stephen Mahago |
|
Back to top |
|
|
bzijlstra
Joined: 30 Dec 2004 Posts: 1179 Location: Tilburg - Netherlands
|
|
Back to top |
|
|
|