in reply to i2c attached LCD Character Display for a Raspberry Pi
anita2R Nice Work!
I plan to look at your code in detail to learn something new about the RPI. I have used the chipKIT UNO32 with a Sparkfun I2C backpack.
How does the 4/8 bit mode stuff come into play over an I2C backpack interface? I thought 4/8 bit mode related to using a 4 or 8 bit parallel interface. This should be handled by the backpack processor.
I think RPI users could be a source of new Perl users. More posts like yours might help this along.
Update: After reading your code it appears that the SainSmart LCD you are using has a much lower level interface than the Sparkfun unit that I used. The Sparkfun backpack hides all of the bit manipulation from the user.
James
There's never enough time to do it right, but always enough time to do it over...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: i2c attached LCD Character Display for a Raspberry Pi
by anita2R (Scribe) on May 26, 2016 at 14:31 UTC | |
I wasn't aware that the SparkFun module provided more than just serial to parallel conversion. The SainSmart backpack is a simple (and cheap) device. I just looked, their 2 x 16 LCD with i2c backpack is under $10 US. There are other similar backpacks out there that you can wire up yourself to an LCD display which are now really cheap. The disadvantage is that the information on using them is poor. While trying to get mine working I read numerous posts from people who could not get theirs to work. In the end I went back to basics, and worked out how the backpacks work and how the LCD 4-bit mode works, and then avoided the high level libraries. Simple i2c communication using the HiPi::BCM2835::I2C was all that was needed. The module is described as: The HiPi::BCM2835::I2C module provides direct access to the Broadcom I2C Serial peripheral. After that it came down to understanding the commands and the way the parallel side of the i2c backpack was connected to the LCD. I will write up some more detailed notes on the 8-bit/4-bit issue and initialization and post it later I have a Perl script that collects data from an spi bus-attached ADC that monitors some voltages. I should tidy up the script and post that as well | [reply] |
by jmlynesjr (Deacon) on May 26, 2016 at 16:54 UTC | |
I went back and looked at my chipKIT code. Turns out my Sparkfun LCD is a SPI interface. My SF 4 digit LED display uses I2C. In either case neither required any bit twiddling. Their backpack has an on-board PIC that abstracts out the HD44780 handling. Ease of use and no soldering comes at a higher price(double) than you have with the SainSmart product. Update:I read through the HiPi docs last night. Good stuff! The developer, Mark Dootson, has done much work on wxPerl and I believe that wxPerl will run on the RPI, if you need to do any GUI work. For Example:
James There's never enough time to do it right, but always enough time to do it over... | [reply] [d/l] |
by Anonymous Monk on Feb 25, 2017 at 16:58 UTC | |
This code uses the HiPi module which seemed to me to require I load the whole GUI (I am using minibian) so I converted a Python demo program to Perl as an illustration of how to use the SMBus module to write to an I2C LCD (16x2). Here is the code:
| [reply] [d/l] |