Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Multiple LCD-Libs in one Program

 
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR
View previous topic :: View next topic  
Author Message
bifi

Bascom Member



Joined: 28 Feb 2005
Posts: 25

germany.gif
PostPosted: Tue Dec 14, 2021 3:25 pm    Post subject: Multiple LCD-Libs in one Program Reply with quote

Hello Bascom Users,

if have an existing Program using a standard LCD-Text Display configured by

Config Lcdpin = Pin , Db4 = Portc.4 , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7 , E = Portc.3 , Rs = Portc.2
Config Lcd = 40x2

The Program runs fine.

Now i need to add an additional display with the SSD1306 controller that, in a separate program, runs as well.
This one uses the O-Family library glcdSSD1306-I2C_V2.lib

But including this lib in the first mentioned program gives an error duplicate label _LCD_INIT
and the program hangs.

How do I have to modify the glcdSSD1306-I2C_V2.lib to work together with the default LCD-Text routines ?

Thanks in advance

Michael

(BASCOM-AVR version : 2.0.8.4 )
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5916
Location: Holland

blank.gif
PostPosted: Tue Dec 14, 2021 9:20 pm    Post subject: Reply with quote

that is not that simple.
while you could give the routine in the graphic lcd a new label name and manual call it, there is another show stopper : _Write_lcd . it would need a compiler change to have it use different names. all LCD routines call a label with that name. and for graphical lcd this label calls some code that calls _Gwrite_Data or it simply jumps to _Gwrite_lcdchar. in order to use both TEXT and GRAPHICAL it means that all calls to _write_lcd for graphical types must be changed in the case of some graphical lcd.

from history there used to be only TEXT lcd displays (affordable). And the first graphical LCD had built in fonts and could be treated as TEXT LCD too. So similar code was needed and used.
If i had known that million different graphical LCD would be created i would have designed it different. Also, 25 years ago it was not really common to have multiple LCD.
I do recognize that it can be usable to have multiple lcd. or to mix graphical and text types. in that case the required changes are doable. the only problem : testing any change is taking more and more effort.
we do not want users to have problems because of a new feature. so it means that it either must be beneficial for many users or that a user find it so important that he does not mind to pay for such a feature.

_________________
Mark
Back to top
View user's profile Visit poster's website
bifi

Bascom Member



Joined: 28 Feb 2005
Posts: 25

germany.gif
PostPosted: Wed Dec 15, 2021 11:22 am    Post subject: Reply with quote

Thanks for your response Mark.
I have written to support.

Michael
Back to top
View user's profile
JC

Bascom Member



Joined: 15 Dec 2007
Posts: 586
Location: Cleveland, OH

usa.gif
PostPosted: Wed Dec 15, 2021 11:21 pm    Post subject: Reply with quote

Building 1 PCB, or many?

Another approach would be to add a second, small, micro to the project.
The Graphics LCD would be connected to the new, small, micro, as a driver for it.
This second micro can use its own GLCDE driver.

The Main micro would then send what it wanted to be displayed to the second micro, which would actually display it.
The Main micro could use a USART, SPI, or I2C, etc., to communicate with the second micro.

You would (likely) put the data you wanted to display in a formatted "packet" to send to the second micro that drives the GLCD.

JC
Back to top
View user's profile Visit poster's website
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1257
Location: SYDNEY

australia.gif
PostPosted: Thu Dec 16, 2021 3:28 am    Post subject: Reply with quote

O-Family has written an I2C driver for graphic LCDs that lets you use up to 8
its just a bit slower than a parallel connection.
https://www.mcselec.com/index2.php?option=com_forum&Itemid=59&page=viewtopic&t=14297&postdays=0&postorder=asc&start=0

Regards Paul
Back to top
View user's profile
EDC

Bascom Expert



Joined: 26 Mar 2014
Posts: 971

poland.gif
PostPosted: Thu Dec 16, 2021 9:53 am    Post subject: Reply with quote

I2C is not much slower for such type of displays (alphanumerical). You can take a look for 17sec video how it perform
-> https://drive.google.com/open?id=0ByTGnTHgAjlzQ1VFTUFxd0VHSG8

But for different displays I also suggest add a second micro (attached to choosed LCD) and extra layer for LCD command in the programm.
I have project with multiple LCDs and even "remote panels" driven over serial command on Bluetooth or even LoRa from ~500m distance.
Second micro gives you opportunity to send back some control for the main device like main panel does.
Then if you have your own protocol then change a display is not a challenge. It`s easy then...

For handling second display in the main programm you must only create subs for displaying and sending messages over designed protocol and then use CTRL + R (find and replace). You type "Lcd " and replace it for example "Lcd_it " (Sub Lcd_it(Byval Msg As String * 20)). Check "whole words only" etc. Then hit replace and whole programm use your sub instead "Lcd". Same with "Locate ".
I can show such a remote second display if you like.
Back to top
View user's profile Visit poster's website
bifi

Bascom Member



Joined: 28 Feb 2005
Posts: 25

germany.gif
PostPosted: Thu Dec 16, 2021 6:05 pm    Post subject: Reply with quote

Thanks to all for your support.

Unfortunately the hardware is fixed and can not be modified.

But ... i found a quick, but dirty solution by modifying some routines i found some time ago
on the german bascom forum. These are some routines for LCD-Text displays up to 4 x 40 characters
connected to the micro by PFC8574 I2C.

I simply modified this by not sending the data via i2c, but mapping instead to the pins of
PORTC, where my character display is conneted to in 4bit mode.

It works, even with multiple SSD1306 displays.

I will clean up my code and make comments and publish it here in the next days.

Thanks to all.

Michael
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    www.mcselec.com Forum Index -> BASCOM-AVR All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum