24X2 LCD control and scrolling

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
User avatar
1Handypal
Flowcode v5 User
Posts: 41
Joined: Fri Jan 06, 2012 8:17 am
Has thanked: 8 times
Contact:

24X2 LCD control and scrolling

Post by 1Handypal »

Hello all,

I am looking into possibility of using 24x2line LCD for my projects. It is fairly standard part as far as I can tell, utilizing one HD44780 and couple HD44100 chips. Since Flowcode does not have native support for this size LCD, what can be done to create a snippet and/or component to use as macro? I am particularly interested to be able to control lines separately and, for instance, have a portion of a line scroll a string of characters, while the other portion of display stays still.

Could somebody explain in more detail and/or give examples, please.

Thanks for your input.

Best.

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: 24X2 LCD control and scrolling

Post by Benj »

Hello,

I believe the 20 x 2 LCD type should work fine with the 24 x 2 hardware. Standard commands such as shifting the display should also work using the command function.

User avatar
1Handypal
Flowcode v5 User
Posts: 41
Joined: Fri Jan 06, 2012 8:17 am
Has thanked: 8 times
Contact:

Re: 24X2 LCD control and scrolling

Post by 1Handypal »

Ben,

Thanks for your valuable input. Honestly, I would like to learn specifics of how to display custom characters on an LCD. As far as my knowledge about LCD goes, there are character maps (maybe more than one) preloaded in non-volatile memory of LCD, a character is pulled and pushed onto display by using commands and their respective arguments.
Could you show an example of how a non-alphanumeric character is displayed on LCD filling all visible positions (i.e. to display rectangular boxes in every position of LCD) , say for testing purpose or else? Sorry if this question sounded too trivial for you, but I believe many people would like to learn manipulations with LCD in more detail.
Another question, when you write to a character map of an LCD to create custom characters, is it permanently modified or does power cycling return it to original state?
Thanks for your help in advance.

Best.

User avatar
Steve
Matrix Staff
Posts: 3426
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: 24X2 LCD control and scrolling

Post by Steve »

I wrote an article a long time ago about creating custom characters on an alpha-numeric LCD. It is here:
http://www.matrixmultimedia.com/mmforum ... =26&t=4796

While the concept is the same, we have added some of this functionality into Flowcode. All you need to do is use the "RAM_Write" function to set the custom character and then display it by using the PrintASCII function (with the char set to the value 0 to 7). Note that only 8 characters can be customised (at any one time). Also, this will work in hardware only and will not simulate.

I'm not sure if the changes are permanent. You should be able to test this very quickly.

User avatar
1Handypal
Flowcode v5 User
Posts: 41
Joined: Fri Jan 06, 2012 8:17 am
Has thanked: 8 times
Contact:

Re: 24X2 LCD control and scrolling

Post by 1Handypal »

Thank you Steve for steering me into right direction.

I am afraid that I am still unclear on a few moments as the following:
How do I change to 8 bit data, as opposed to 4 bit built in peripheral, should my LCD require?
I attached a sample project for your review, if you would be so kind, and would like to know if there is more elegant way of doing the same operation on ASCII print. Is it possible to set up a string of characters and what the appropriate syntax should look like to get the same effect?
Just a note, somehow on an earlier version, I believe being 4.2 or something, this projects simulates differently... in fact with this version, being limited 4.3.9.65, I do not see anything on LCD...
Any ideas would be very much welcome.

Best.
Attachments
DISPLAY TEST1.fcf
(8 KiB) Downloaded 391 times

User avatar
Steve
Matrix Staff
Posts: 3426
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: 24X2 LCD control and scrolling

Post by Steve »

If you want to use 8-bit data mode, you will need to customize the C code behind the component.

Your program is trying to display the ASCII character 31, which is outside the printable range of ASCII characters. If I change it to print 33, then the program works fine - it prints exclamation marks across the display.

You can do a similar thing by creating a string and then adding characters to the end of the string. When the string is ready for display, use the PrintString macro.

User avatar
1Handypal
Flowcode v5 User
Posts: 41
Joined: Fri Jan 06, 2012 8:17 am
Has thanked: 8 times
Contact:

Re: 24X2 LCD control and scrolling

Post by 1Handypal »

Thanks again for your continuous effort to enlighten me...
Steve wrote:If you want to use 8-bit data mode, you will need to customize the C code behind the component," this sure sounds easy for someone proficient, which is not the case with me...

"Your program is trying to display the ASCII character 31, which is outside the printable range of ASCII characters." Steve, you may be surprised to know that it actually works (displaying black boxes ASCII 31) in my setup. I haven't tried in hardware yet... Still need to figure out what changes to make/files to edit to switch to 8bit LCD interface.

"If I change it to print 33, then the program works fine - it prints exclamation marks across the display", You are right about this, I just wanted to get other characters on display.

"You can do a similar thing by creating a string and then adding characters to the end of the string. When the string is ready for display, use the PrintString macro. " It would be nice to have an example of syntax, since C coding is not my strong suite
On a side note, I visited a place http://www.noritake-itron.com/pages/ and was quite excited to see the options available within. So it should pay off to learn in depth how to properly code to utilize all this new display technology, would you agree?

Post Reply