I2C LCD Control - Custom Characters | Arduino Compatible Compiler for LabVIEW Discussions | Forum

Avatar
Please consider registering
guest
sp_LogInOut Log In sp_Registration Register
Register | Lost password?
Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
sp_Feed Topic RSS sp_TopicIcon
I2C LCD Control - Custom Characters
August 9, 2016
9:26 am
Avatar
AK7466
Guest
Guests

Hi.

I am new Arduino and this forum, but not LabVIEW.

This is my first post, so please let me know if I have not correctly followed any of the forum protocols!

 

I need to define some custom characters within an LCD module (SainSmart 4 line).

In addition to writing the bit pattern to the LCD Data Registers, this task also requires that the "Set CGRAM Address" is written to the Instruction Register, immediately before the data.

Control Instruction differ from Data by having the RS bit set to 0 for Instructions Registers, and 1 for Data Registers.

I have not been able to find a way to do this using the LCD functions supplied.

Please could someone tell me the correct way to approach this?

Many thanks

Regards

AK

August 9, 2016
2:18 pm
Avatar
Steffan
Admin
Forum Posts: 408
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

Is this an I2C LCD?  The SainSmart LCD is usually I2C based, which the I2C module takes care of the RS Bit control for you.  Either way, custom characters may only be possible by creating your own Arduino library wrapper.  We can take a look if there is another workaround, just let us know which specific LCD you are using.

August 9, 2016
2:34 pm
Avatar
AK7466
Guest
Guests

Hi Steffan.  Many thanks for the prompt reply.

The LCD module is a Sainsmart, 4 line module, Part No. 2004A, with 8574A I2C Interface.

I have successfully written a LabVIEW "bit-banging" program to communicate with it via a USB to I2C interface ISS

(one of these... https://www.robot-electronics......s_tech.htm ),

and I expect that I could port this to the Arduino, but it would be much more elegant, and may help other users if there was an LCD control function to handle this on the LV Arduino function pallette. 

Any suggestions would be very much appreciated.

Thanks for a great product!

Regards

AK

August 9, 2016
5:20 pm
Avatar
Steffan
Admin
Forum Posts: 408
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

Ok, that is the standard I2C LCD that is supported by the Compiler.  The Arduino library that is used does implement a custom character API.  However, this has not been implemented as part of the Compiler.  I agree, this would be a good addition to the palette.  There should be a simple way to create an addon that only implements the custom character functionality though.  I have an LCD here so will try to mock up an addon that implements this.  Will get back to you.

August 10, 2016
4:47 am
Avatar
Steffan
Admin
Forum Posts: 408
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

This should work for you.  Unzip to the addons directory of the Compiler and take a look at I2C LCD extension example.vi.  Refer to the user manual for creating and adding addons.

August 10, 2016
3:43 pm
Avatar
AK7466
Guest
Guests

Hi Steffan

Thanks for the attachment.  I will give it a try in the next day or so. (when work permits!)

Regards

 

AK

August 14, 2016
3:36 pm
Avatar
AK7466
Guest
Guests

Hi Steffan. Thanks for the VIs which worked perfectly!

The application was to draw a horizontal bar graph on the Sainsmart 2004A with 1% resolution.

This was achieved by defining 6 characters in the CGRAM locations 0 to 5. The character in location 0 was blank (no pixels illuminated), and each successive character is 1 pixel wider, with location 5 being a solid illuminated block.

I have attached the VIs which I hope will save others users some work.

I have also attached a broken VI, to show how it cannot be done! (perhaps you could tell me why this one breaks?)

Thanks again for the help.  5 star support!

AK7466

August 14, 2016
4:21 pm
Avatar
Steffan
Admin
Forum Posts: 408
Member Since:
March 12, 2015
sp_UserOfflineSmall Offline

Good to hear.  The reason why the broken one does not compile is because you have used a 2-D array, which is not supported by the Compiler.  Only one dimensional arrays are supported by the Compiler as documented in the Array section of the help manual.

August 14, 2016
4:36 pm
Avatar
AK7466
Guest
Guests

Thanks Steffan.  I remember now, - if all else fails read the manual! 🙂

 

AK

Forum Timezone: UTC 0
Most Users Ever Online: 100
Currently Online:
21
Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
miche91: 33
scottj: 28
scadao: 23
Member Stats:
Guest Posters: 5
Members: 202
Moderators: 0
Admins: 3
Forum Stats:
Groups: 1
Forums: 2
Topics: 266
Posts: 1222
Newest Members:
pujacontrol
Administrators: geadmin: 22, filipealtoe: 96, Steffan: 356