View previous topic :: View next topic |
Author |
Message |
O-Family
Joined: 23 May 2010 Posts: 320 Location: Japan
|
Posted: Sat Mar 20, 2021 1:19 am Post subject: Question of 'AN #118 - I2C LCD and Keboard library' |
|
|
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 |
|
|
O-Family
Joined: 23 May 2010 Posts: 320 Location: Japan
|
Posted: Tue Mar 23, 2021 4:07 am Post subject: |
|
|
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 |
|
|
laborratte
Joined: 27 Jul 2005 Posts: 299 Location: Berlin
|
Posted: Tue Mar 23, 2021 11:53 am Post subject: |
|
|
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 |
|
|
O-Family
Joined: 23 May 2010 Posts: 320 Location: Japan
|
Posted: Wed Mar 24, 2021 2:49 am Post subject: |
|
|
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 |
|
|
Paulvk
Joined: 28 Jul 2006 Posts: 1257 Location: SYDNEY
|
Posted: Wed Mar 24, 2021 9:50 am Post subject: |
|
|
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 |
|
|
O-Family
Joined: 23 May 2010 Posts: 320 Location: Japan
|
Posted: Wed Mar 24, 2021 2:29 pm Post subject: |
|
|
I think the graphic LCD is possible with this MCP23017 board. |
|
Back to top |
|
|
SZTRAD
Joined: 30 Dec 2019 Posts: 165
|
Posted: Wed Mar 24, 2021 4:20 pm Post subject: |
|
|
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 |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Wed Mar 24, 2021 8:53 pm Post subject: |
|
|
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 |
|
|
|