Creating Custom LCD Characters Flowcode V4 & V5

Tips, Tricks and methods for programming, learn ways of making your programming life easier, and share your knowledge with others.

Moderators: Benj, Mods

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8287
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2372 times
Been thanked: 3379 times
Contact:

Creating Custom LCD Characters Flowcode V4 & V5

Postby medelec35 » Sat Mar 02, 2013 3:17 am

Objective: Create a custom volume display with lowest volume showing a single line, next volume level = 2 lines etc.
Just like this:
Volume 1.png
Volume 1.png (3.02 KiB) Viewed 12566 times


You don't need to add any custom code to LCD component.
Just add code at the beginning of you program in the form of:

Code: Select all

FCD_LCDDisplay0_RAM_Write(Custom char number,row1 data,row2 data,row3 data,row4 data,row5 data,row6 data,row 7data,row 8data);

To obtain correct data values, go to:
http://www.quinapalus.com/hd44780udg.html
Thanks to Steve for this link in his original Flowcode V3 Customized characters on the LC (viewtopic.php?f=26&t=4796)
Make sure 5x8 is selected!
There you will see a green rectangle which represents your LCD character.
(You will also see some more created custom characters).
Click on the parts of the green rectangle to create your custom character.
E.g for just the bottom line (1st character used in volume control Flowchart), just select the bottom line of rectangle:
Volume 2.png
Volume 2.png (111.32 KiB) Viewed 12507 times

Notice the numbers in the 'In decimal:; window?
These are the ,row1 data,row2 data etc and what will will be using in the C code at the beginning of our flowchart.
The 1st custom character will be char 0, second will be 1, 3rd will be 2 etc this is what goes at the Custom char number part of C code just before the ,row data.
I just copied and pasted all the numbers. Its as simple as that. :)
So we now have all the information for the C code box:
For the thinnest line (lowest volume ):

Code: Select all

FCD_LCDDisplay0_RAM_Write(0,0,0,0,0,0,0,0,31);

Don't forget the 1st number is the custom character number which we are calling 0

For the two lines:

Code: Select all

FCD_LCDDisplay0_RAM_Write(1,0,0,0,0,0,0,31,31);
This we are calling custom character 1
etc.
To display the custom character, Just use PrintASCII(custom character number) LCD component
E.g

Code: Select all

PrintASCII(0)
The 0 is the custom character number I mentioned.

Important: Since custom characters use C code, then they will not simulate within Flowcode.
The only solution is to use either hardware of a simulator that works with hex files.
Image of LCD within this post is the Real Pic simulator which is loaded with a hex file generated by attached flowchart.
Also if you see and error message when compiling like this:
error: arguments of 'FCD_LCDDisplay0_RAM_Write' don't match the parameters of call
This is because there should be a total of 9 numbers.
The char number + 8 Data numbers. Check that 5 by 8 is selected and not 5 by 7.

Now you can see how easy it is to make custom LCD character your no longer restricted to character sets pre-loaded into LCDs.
I would recommend creating a maximum number of 31 as I believe anymore could interfere with the standard LCD characters.

Another example involving a 'Play' symbol can be found here:
viewtopic.php?f=46&t=11982#p45592

Martin
Attachments
Volume Up Down.fcf
(8.5 KiB) Downloaded 978 times
These users thanked the author medelec35 for the post (total 8):
brandonb (Sat Mar 02, 2013 6:31 am) • Enamul (Sat Mar 02, 2013 3:26 pm) • Spanish_dude (Wed Sep 11, 2013 9:05 pm) • jgu1 (Mon Sep 16, 2013 6:51 am) • Benj (Tue Aug 18, 2015 12:45 pm) • EtsDriver (Sat Jul 02, 2016 12:19 pm) • George_B (Sat Jul 02, 2016 8:40 pm) • ncc1502 (Thu Dec 06, 2018 12:45 am)
Rating: 44.44%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

brandonb
Posts: 438
Joined: Mon Aug 29, 2011 12:26 am
Location: arizona
Has thanked: 175 times
Been thanked: 173 times
Contact:

Re: Creating Custom LCD Characters Flowcode V4 & V5

Postby brandonb » Sat Mar 02, 2013 10:52 am

wow, thats really cool, try this to see what i think of it

Code: Select all

FCD_LCDDisplay0_RAM_Write(0,14,31,0,10,0,17,14,0);

i had no clue it was that easy in flowcode, after i read the web link i have a quicker way of generating the number code!
download mikroc free version, there is a custom lcd char creation under tools, can click on the dots that you want to be on and generate code for it, the code that it gives just add the char# before the first one and whahlah
... oops, here is flowchart
custom characters.fcf
(7.5 KiB) Downloaded 913 times
These users thanked the author brandonb for the post:
medelec35 (Sat Mar 02, 2013 11:02 am)
Rating: 5.56%
 

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8287
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2372 times
Been thanked: 3379 times
Contact:

Re: Creating Custom LCD Characters Flowcode V4 & V5

Postby medelec35 » Sat Mar 02, 2013 11:44 am

Thanks Brandon :)

brandonb wrote: after i read the web link i have a quicker way of generating the number code!
download mikroc free version, there is a custom lcd char creation under tools, can click on the dots that you want to be on and generate code for it, the code that it gives just add the char# before the first one and whahlah


Tried that method and it works really well!

I was just trying to find a link where no downloading was required. :)


brandonb wrote:wow, thats really cool, try this to see what i think of it

Brandons custom char.png
Brandons custom char.png (68.25 KiB) Viewed 12543 times

Very clever :lol:


Martin
These users thanked the author medelec35 for the post:
brandonb (Sat Mar 02, 2013 6:18 pm)
Rating: 5.56%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8287
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2372 times
Been thanked: 3379 times
Contact:

Re: Creating Custom LCD Characters Flowcode V4 & V5

Postby medelec35 » Wed Sep 11, 2013 9:40 pm

Update.
For forward compatibility rather than use a c box with :
FCD_LCDDisplay0_RAM_Write(0,14,31,0,10,0,17,14,0);
It will be best to used LCD function:
Custom component.png
Custom component.png (80.32 KiB) Viewed 11633 times

Thanks to Ben for posting a flowchart with RAM_Write LCD function.

Martin
These users thanked the author medelec35 for the post:
kersing (Sat Jul 02, 2016 10:40 am)
Rating: 5.56%
 
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.

George_B
Posts: 88
Joined: Wed Jul 04, 2012 11:21 pm
Has thanked: 37 times
Been thanked: 12 times
Contact:

Re: Creating Custom LCD Characters Flowcode V4 & V5

Postby George_B » Sat Jul 02, 2016 9:37 am

Hello to all!


Using Flowcode 6, I was trying to add a few custom characters into the LCD as medelec35 presented above.

I managed to add some custom characters but after adding the 9th character i am facing a problem. The problem is that instead of the character number 9 the LCD shows a random character from address 0 to 9.

Is there any limitation of the number of custom characters that someone can add?



Thanks in advance
George

EtsDriver
Valued Contributor
Valued Contributor
Posts: 407
Joined: Tue Apr 15, 2014 4:19 pm
Location: Kajaani, Finland
Has thanked: 328 times
Been thanked: 210 times
Contact:

Re: Creating Custom LCD Characters Flowcode V4 & V5

Postby EtsDriver » Sat Jul 02, 2016 12:14 pm

George_B wrote:Hello to all!


Using Flowcode 6, I was trying to add a few custom characters into the LCD as medelec35 presented above.

I managed to add some custom characters but after adding the 9th character i am facing a problem. The problem is that instead of the character number 9 the LCD shows a random character from address 0 to 9.

Is there any limitation of the number of custom characters that someone can add?



Thanks in advance
George


Hi!

On the Bert Van Dam's book "Create 30 PIC microcontroller projects with FLOWCODE 6" he states that the LCD controller on LCD eblock has only 8 custom user defineable character spaces. (HD48770) It really depends on your LCD manufacturer which parts you can poke, but usually i think all are open to edit all characters, but dont blame me if you mess your lcd up with it... But usually eight are free. The custom chracters are really just downloaded over "control codes" that are ususally meant to not show up. The last (255) should always be left untouched.

The eight custom charactes are located this way in memory according to the book:

ASCII | LCD MEMORY ADDRESS | DISPLAY COMMAND
0 | 64 | PrintASCII(0)
1 | 72 | PrintASCII(1)
2 | 80 | PrintASCII(2)
3 | 88 | PrintASCII(3)
4 | 96 | PrintASCII(4)
5 | 104 | PrintASCII(5)
6 | 112 | PrintASCII(6)
7 | 120 | PrintASCII(7)

Hitachi datasheet:
http://fab.cba.mit.edu/classes/863.06/11.13/44780.pdf

hitachidata1.JPG
(149.07 KiB) Downloaded 3039 times

hitachidata2.JPG
(177.45 KiB) Downloaded 3039 times

I personally use almost always the A02 mapped lcd's, so i have never had a play with that custom character system. :D
These users thanked the author EtsDriver for the post (total 3):
medelec35 (Sat Jul 02, 2016 12:38 pm) • kersing (Sat Jul 02, 2016 12:59 pm) • George_B (Sat Jul 02, 2016 8:40 pm)
Rating: 16.67%
 
Ill just keep the good work up!

ncc1502
Posts: 42
Joined: Mon Apr 07, 2008 9:18 pm
Has thanked: 18 times
Been thanked: 7 times
Contact:

Re: Creating Custom LCD Characters Flowcode V4 & V5

Postby ncc1502 » Thu Dec 06, 2018 1:02 am

Hi Martin,

Do you know how this should be done in Flowcode 6?

If I compile your program I get errors:
Volume Up Down_v6.c(686:2): error: unknown identifier 'FCD_LCDDisplay0_RAM_Write'
Volume Up Down_v6.c(686:2): error: failed to generate expression
Volume Up Down_v6.c(687:2): error: unknown identifier 'FCD_LCDDisplay0_RAM_Write'
Volume Up Down_v6.c(687:2): error: failed to generate expression
Volume Up Down_v6.c(688:2): error: unknown identifier 'FCD_LCDDisplay0_RAM_Write'
Volume Up Down_v6.c(688:2): error: failed to generate expression
Volume Up Down_v6.c(689:2): error: unknown identifier 'FCD_LCDDisplay0_RAM_Write'
Volume Up Down_v6.c(689:2): error: failed to generate expression
Volume Up Down_v6.c(690:2): error: unknown identifier 'FCD_LCDDisplay0_RAM_Write'
Volume Up Down_v6.c(690:2): error: failed to generate expression
Volume Up Down_v6.c(691:2): error: unknown identifier 'FCD_LCDDisplay0_RAM_Write'
Volume Up Down_v6.c(691:2): error: failed to generate expression
Volume Up Down_v6.c(692:2): error: unknown identifier 'FCD_LCDDisplay0_RAM_Write'
Volume Up Down_v6.c(692:2): error: failed to generate expression
Volume Up Down_v6.c success

ncc1502
Posts: 42
Joined: Mon Apr 07, 2008 9:18 pm
Has thanked: 18 times
Been thanked: 7 times
Contact:

Re: Creating Custom LCD Characters Flowcode V4 & V5

Postby ncc1502 » Thu Dec 06, 2018 1:34 am

I do not understand how you convert the numbers you want to display to the ram write box (in your picture).

What should I use if I want to display 14,31,27,21,23,21,27,14, so FCD_LCDDisplay0_RAM_Write(0,14,31,27,21,23,21,27,14);

User avatar
medelec35
Valued Contributor
Valued Contributor
Posts: 8287
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2372 times
Been thanked: 3379 times
Contact:

Re: Creating Custom LCD Characters Flowcode V4 & V5

Postby medelec35 » Thu Dec 06, 2018 10:30 am

ncc1502 wrote:Do you know how this should be done in Flowcode 6?

You need to follow this updated post and not compile the original flowchart.
Judging by EtsDriver post, you can only use 8 custom characters.
Martin

If you read a post that is useful, please show appreciation by clicking on thumbs up Icon.