Forum - MCS Electronics

 

FAQFAQ SearchSearch RegisterRegister Log inLog in

Question of 'AN #118 - I2C LCD and Keboard library'

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

Bascom Expert



Joined: 23 May 2010
Posts: 257
Location: Japan

japan.gif
PostPosted: Sat Mar 20, 2021 1:19 am    Post subject: Question of 'AN #118 - I2C LCD and Keboard library' Reply with quote

Don't you think the initialization signal is strange for the I2C LCD library using PCF8574?
Is this a phenomenon only for my hardware?

The output result is different from the parameter of "Lcd_i2c.lib".
There is also a difference in the initialization of the LCD controller HD44780 data sheet.

(BASCOM-AVR version : 2.0.8.3 )
Back to top
View user's profile Visit poster's website
O-Family

Bascom Expert



Joined: 23 May 2010
Posts: 257
Location: Japan

japan.gif
PostPosted: Tue Mar 23, 2021 4:07 am    Post subject: Reply with quote

In 'lcd_i2c.LIB'.
The '* BASIC: waitms 4' line seems to corrupt the contents of the variable '_temp1'.
I think that some LCDs may fail to initialize.

Also, is register R24 and variable '_temp1' overlaid in the '_write_lcd_byte:' routine?
I don't understand that '_temp1' is restored when pop R24.
Back to top
View user's profile Visit poster's website
laborratte

Bascom Expert



Joined: 27 Jul 2005
Posts: 283
Location: Berlin

germany.gif
PostPosted: Tue Mar 23, 2021 11:53 am    Post subject: Reply with quote

comparing your measurements and the code _temp1 is clearly an alias for R24 or R25. As R24 and R25 are used and changed in *BASIC: waitms 4, _temp1 has the value of &h00 after waitms, that is corresponding to you measurement.

I would suggest a bugfix by adding a additional Ldi _temp1, &h03 like:
Code:

(...)
[_Init_LCD]
_Init_LCD:
 *BASIC: waitms 50
 ldi r16,&hc0       ; this is to make the initialization on both halfs of a 4-line LCD
 Ldi _temp1, &h03   ; at init-time I call all routines before _lcd_e is loaded into r16
 Rcall _Send_to_LCD
 *BASIC: waitms 4

 Ldi _temp1, &h03   ; reset _temp1 with the value as it is deleted in waitms

 Rcall _Send_to_LCD
 Rcall _Send_to_LCD
(...)
 
Back to top
View user's profile
O-Family

Bascom Expert



Joined: 23 May 2010
Posts: 257
Location: Japan

japan.gif
PostPosted: Wed Mar 24, 2021 2:49 am    Post subject: Reply with quote

Thank you for checking.
I think the fix will improve it too.

Also,'bl_lcd_i2c.LIB' with backlight control has the same bug.
We are currently editing a new library to include additional features.
Back to top
View user's profile Visit poster's website
Paulvk

Bascom Member



Joined: 28 Jul 2006
Posts: 1216
Location: SYDNEY

australia.gif
PostPosted: Wed Mar 24, 2021 9:50 am    Post subject: Reply with quote

It would have been nice to have an I2C library using two PCF8574s for the basic graphic displays these use a lot of pins.
The bugs may explain some of the intermittent odd things I have experienced.
Regards Paul
Back to top
View user's profile
O-Family

Bascom Expert



Joined: 23 May 2010
Posts: 257
Location: Japan

japan.gif
PostPosted: Wed Mar 24, 2021 2:29 pm    Post subject: Reply with quote

I think the graphic LCD is possible with this MCP23017 board.
Back to top
View user's profile Visit poster's website
SZTRAD

Bascom Member



Joined: 30 Dec 2019
Posts: 132

blank.gif
PostPosted: Wed Mar 24, 2021 4:20 pm    Post subject: Reply with quote

Yes, it is.
The standard alphanumeric LCD is usable in this configurationwithout any problem.
Refresh for graphic is at the level of standard I2C graphic display.
RS
Back to top
View user's profile
albertsm

Administrator



Joined: 09 Apr 2004
Posts: 5298
Location: Holland

blank.gif
PostPosted: Wed Mar 24, 2021 8:53 pm    Post subject: Reply with quote

instead of using waitms you can use waitUS , of course adjusting the value a factor 1000.
waitus does not trash regs.

_________________
Mark
Back to top
View user's profile Visit poster's website
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