12-09-2012 07:11 PM
Hey gang, I've been using the LIFA drivers and a sbRIO 9632 quite successfully through the single Serial port that's available on the sbRIO. I've not needed to make changes to the LIFA firmware that gets loaded on the arduino first (it's an UNO) since I stuck to the pins as outlined in the example VI's (turned the LCD one into an event based state machine that works well).
Problem is, I'm now needing drive a separate LCD and I was wondering if anyone adapted or worked out the byte command stacking and shifting that's required for the I2C for driving an LCD? I've got the Arduino going already, so seemed appropriate to try and do this over the I2C port that's available.
My budget's busted so I can't but a serial add-on module for the sbRIO... I have been toying around with the FPGA to I2C code that I've found in the LabVIEW forms, but I'm not so comfortable with the massaging of bytes that's needed to drive the LCD. This particular board has a HITACHI controller behind the I2C chip, and I was thinking of using the direct control of that Hitachi chip since I have so many available digital ports, but I thought I'd see if anyone had any luck through the Arduino.
Any thoughts/ideas would be appreciated. Thanks so much to all who put this together. Really cool stuff.
TR
Solved! Go to Solution.
12-10-2012 08:39 PM
What LCD are you using that accepts I2C?
12-12-2012 09:47 AM
SainSmart? Has the I2C converter chip board piggybacked on a 20x4 LCD. Instead of ferreting out the I2C bitstream, I just manipulated the LIFABase code to use both LCD's (one with the standard LiquidCrystal library, one with the LiquidCrystal_I2C library). Working great, but I've got some work to do adapting the LabVIEWInterface code to accept another set of commands (adding entries to the case structure).
Another thing I did was to increase the number of bytes per packet to 20 (from the standard 15) so I can enter a full line of text on a 16x2 line display.
Also, I'm working on adding commands to support the serial control of a 4DSystems uOLED display using the LIFABase code.
Good stuff.
12-12-2012 09:58 PM
It sounds like you are making progress, that is good to hear.
03-13-2013 05:59 PM
hello,
Up today I used LCD with Serial Interface. I need to save digital pins to perform some new peripherical controls.
So I need to use a I2C interface connected to the LCD.
Could you help to update firmare with I2C crystal lib and lifa controls
Thanks
Nico
PS: excuse me for my bad english
03-14-2013 02:08 PM
I included the LiquidCrystal I2C library in the Arduino IDE found on this page.
http://arduino-info.wikispaces.com/LCD-Blue-I2C
Make sure in your header file you use the correct I2C (0x##) address for your LCD panel (I assume it's equipped with a serial to I2C board such as this one I'm using from Sain Smart).
You'll have to include the header information in the main LIFA_Base.ino file for calls to the I2C library:
#include <stdlib.h>
#include <SoftwareSerial.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
I distinguished a separate LCD (from the traditional serial one) with this in setup call to the library:
LiquidCrystal_I2C lcd1(0x3f,20,4);
Then normal commands will work in the main LIFA_Base.ino file such as:
lcd1.init();
lcd1.backlight();
lcd1.clear();
***Note the "1" in the lcd command call
I also added #include <LiquidCrystal_I2C.h> to the LabVIEWInterface.ino file
In this file you can add commands to the list of case structure command list that are called up with the LabVIEW Arduino VI's
You should roll your own command set here (I have a lot of other added code that will get in your way), but as an example I added:
case 0x2E: // Clear Big LCD
lcd1.clear();
delay(50);
Serial.write('0');
break;
case 0x2F: // Init Big LCD
lcd1.init();
delay(50);
Serial.write('0');
break;
There is a Type Def that establishes the command set. I just added the lcd1 equivalents in that Type Def and could call up the I2C LCD with no problems (remember that I2C is a bit slower).
Here's a partial shot of my adjusted Command.ctl Type Def.
I haven't bothered to remove unused commands (and as such, the new commands are out of order). And I've successfully added the ability to drive an oLED (from 4DSystems) the same way (notice the added oLED commands in the graphic).
After editing the Command set, it's just a matter of calling the command and whatever is in the particular case will be executed on the Arduino.
This code sets the cursor location, for example:
The built-in VI's from the LIFA package all seem to work just fine.
A chain of these commands might look like this:
As far as hardware connections, SCL goes to A0, SCD goes to A1, and each should be tied to 5V through a 4.7k minimum pull up resistor.
Good luck.
TR
03-15-2013 02:23 PM
Hello Trouinky,
I need to congratulate you to have solved my problem.
The problem was coming from my Vi and not from my arduino firmware. In fact i wanted to communcate with LCD by using Arduino I2C init & write Vis.
I can continue to debug
Thanks a lot
Best regards
Nico
04-19-2014 03:26 AM
I am still new to LabView and Arduino, currently want to setup a I2C LCD with arduino and labview. I try follow the step you provided but I am stucked half way. Can you provide more details tutorial? Thank you!
04-19-2014 01:06 PM
Since you are new, I would recommend that you start working with LINX (LIFA is deprecated and no longer offcially supported). You can do I2C communication directly from the LINX LabVIEW API. It's not quite the same as the "solution" above but that's my recommendation.
04-20-2014 12:23 PM
Thank for you recommendation. I already installed the LINX but need take some time to get use to it. Currently my sensor setup using arduino uno and labview (LIFA) is almost done, just left I need to show my sensor detected value on my LCD2004 I2C.
From the answer by trouinky, I am not so understand with the sentence "There is a Type Def that establishes the command set. I just added the lcd1 equivalents in that Type Def and could call up the I2C LCD with no problems (remember that I2C is a bit slower)." and onward...
I already add the Item on my command.ctl, but how I calling the command?
Sorry, maybe my question is confusing.