C++ using customer characters? OK204-25-USB

LK/ELK/VK/PK/OK/MX/GLK/EGLK/GVK/GLT Series

Moderators: Henry, Mods

Post Reply
mascenzi
LCD?
Posts: 8
Joined: Thu Apr 25, 2019 9:18 am

C++ using customer characters? OK204-25-USB

Post by mascenzi » Tue Apr 30, 2019 1:30 pm

What am I missing? So I've been messing with my OK204-25-USB for about a week. I've figured out the communication on most of the functionality. Creating and using bars, medium/large numbers, moving cursor around, displaying text, etc. However, creating custom Characters I'm confused.

Lets look at the command for Creating a Custom Character {254, 78}. Here you supply the ID for the character and 8 bytes that will represent a 5x8 batch of pixels.

Can I then use that custom character without saving it? Or do I have to save it first? I understand if I switch bank or power down that character will be lost, but can I use it util either of those occur?

Now lets say I have to save it first. No problem. So I'll use Saving Custom Characters {254, 193}. Here I supply the bank I want to store it in, the ID of the custom character and then 8 bytes that, again, represent a 5x8 batch of pixels.

Whats the reason for having to supply the 8 bytes again if I've already created it previously? Why couldn't I just supply the bank I want to store it in and the ID I assigned to the custom character when I used the command {254, 78}?

Ok lets say I save it in bank "0" and ID "1". How do I use it? How do I send it to the display? I don't see any commands to use a custom character in the manual? Am I overlooking it? I see how to load a bank of custom characters [254, 192], but once I have the bank I want, how do I call say ID 4?

Daniel Divino
Matrix Orbital
Matrix Orbital
Posts: 247
Joined: Thu Sep 24, 2015 9:38 am

Re: C++ using customer characters? OK204-25-USB

Post by Daniel Divino » Tue Apr 30, 2019 4:31 pm

Hi mascenzi,

It won't be necessary for you to save your custom characters in order to use them.
Once a character is created, you can draw it on screen it by sending the assigned custom character ID to the display.

I have a pseudo code example demonstrating how to use custom characters below:

ClearScreen(); //Clears the display
CreateACustom(0x00, 0x0A, 0x0A, 0x0A, 0x00, 0x00, 0x11, 0x0E, 0x00); //Creates a custom smiley face character with an ID of 0
WriteString(HelloWorld); //Writes 'Hello World' to the display
WriteValue(0x00); //Sends Hex value 0x00 to the display. This will draw the custom smiley face character on screen

Using saved custom characters will follow a similar procedure:

ClearScreen(); //Clears the display
SaveACustom(0x00, 0x00, 0x0A, 0x0A, 0x0A, 0x00, 0x00, 0x11, 0x0E, 0x00); //Saves a custom smiley face character with an ID of 0 in memory bank 0
WriteString(HelloWorld); //Writes 'Hello World' to the display
LoadCustomCharacters(0x00); //Loads custom character bank 0
WriteValue(0x00); //Sends Hex value 0x00 to the display. This will draw the custom smiley face character on screen

Hopefully this helps clarify how custom characters can be used.

If you have any other questions or concerns, please let me know!

Cheers,
Daniel
Daniel Divino
Technical Support
Matrix Orbital

mascenzi
LCD?
Posts: 8
Joined: Thu Apr 25, 2019 9:18 am

Re: C++ using customer characters? OK204-25-USB

Post by mascenzi » Wed May 01, 2019 6:14 am

Daniel,

Thank you so much for following up with me. I'm glad to hear that I can skip the saving part and just store them in my program and send them as I need them. This gives me a lot more options for creating imagery on the display.

However, I'm still not sure what commands I'll need to send. In your pseudo code you give:

Code: Select all

ClearScreen(); //Clears the display
CreateACustom(0x00, 0x0A, 0x0A, 0x0A, 0x00, 0x00, 0x11, 0x0E, 0x00);
WriteString(HelloWorld);
WriteValue(0x00); 
When I'm writing the software the first three are easy. The commands I would use are.

Code: Select all

unsigned char clearScreen[] = {0xFE, 0x58};
unsigned char customChar[] = {0xFE, 0x4E, 0x0A, 0x0A, 0x0A, 0x00, 0x11, 0x0E, 0x00};
unsigned char message[] = "Hello World!";
and I would send each of them this way.

Code: Select all

WriteFile (my_port, &clearScreen, sizeof (clearScreen), &bytes_written, NULL);
WriteFile (my_port, &customChar, sizeof (customChar), &bytes_written, NULL);
WriteFile (my_port, &message, sizeof (message), &bytes_written, NULL);
but with the WriteValue(0x00);

Would that just be

Code: Select all

unsigned char value[] = {0x00};
or is there a command that I need to send like

Code: Select all

unsighed char value[] = {0xFE, 0x??, 0x00};

Daniel Divino
Matrix Orbital
Matrix Orbital
Posts: 247
Joined: Thu Sep 24, 2015 9:38 am

Re: C++ using customer characters? OK204-25-USB

Post by Daniel Divino » Wed May 01, 2019 9:41 am

Hi Mascenzi,

You should be able to send either of the following:

WriteFile(my_port,"\0x00", 1, &bytes_written, NULL);

or

unsigned char b = 0x00;
WriteFile(my_port,&b, 1, &bytes_written, NULL);

No command will be needed to draw the custom character on the screen.

Cheers,
Daniel
Daniel Divino
Technical Support
Matrix Orbital

mascenzi
LCD?
Posts: 8
Joined: Thu Apr 25, 2019 9:18 am

Re: C++ using customer characters? OK204-25-USB

Post by mascenzi » Thu May 02, 2019 5:27 am

Daniel,

Thank you for your time and help.

Daniel Divino
Matrix Orbital
Matrix Orbital
Posts: 247
Joined: Thu Sep 24, 2015 9:38 am

Re: C++ using customer characters? OK204-25-USB

Post by Daniel Divino » Thu May 02, 2019 8:38 am

No worries Mascenzi,

Let me know if you have any other questions!

Thanks,
Daniel
Daniel Divino
Technical Support
Matrix Orbital

Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests