Hi all,
I wonder if some could give me a few pointers on where I might be going wrong. I'm trying to set up some custom characters and can't get the unit to write anything to the screen.
This is the perl code I'm using:
my $set = sprintf "%cN%c%c%c%c%c%c%c%c%c", 0xfe, 0x07,
0x04, 0x0e, 0x1f, 0x00, 0x1f, 0x0e, 0x04, 0x00;
print DISPLAY "$set\n";
$char = sprintf ("%c", 0x07);
$test_string = "This is a test: $char";
display_text ($test_string);
I can get it to display normal text and the built in characters such as the -> but I can't seem to display anything which I try and create!
I'm not totally sure about the numbers in $set but it doesn't seem to matter what I put in.
Any help gratefully received.
Thanks,
Gareth.
Displaying custom characters
What I see looks good. I'm guessing you've looked over the Display.pm you can download from MO.
The only thing I wonder about (based on what you're showing me) is display_text(). Does
print DISPLAY ""$char\n";
work at all? I can't see what display_text() is doing obviously.
The only thing I wonder about (based on what you're showing me) is display_text(). Does
print DISPLAY ""$char\n";
work at all? I can't see what display_text() is doing obviously.
BLK202A-4BR-BK + LK202-25-WB-V + LK204-25-V + VK204-25-V + LK-202-24-USB + MX212
-
- LCD?
- Posts: 2
- Joined: Thu Feb 20, 2003 11:06 am
The display_text is just one of the functions I have in Display.pm
sub display_text
{
my ($text) = @_;
print DISPLAY "$text\n";
}
I tried what you suggested just:
print DISPLAY "$char\n";
but that doesn't put anything at all to the screen.
I don't understand it, I've been trying for ages and haven't got anywhere!
Perhaps I'm not defining the characters correctly?
I assume that all the LCD modules can do this, I guess so as the manual says that it can (LK202-25)
sub display_text
{
my ($text) = @_;
print DISPLAY "$text\n";
}
I tried what you suggested just:
print DISPLAY "$char\n";
but that doesn't put anything at all to the screen.
I don't understand it, I've been trying for ages and haven't got anywhere!
Perhaps I'm not defining the characters correctly?
I assume that all the LCD modules can do this, I guess so as the manual says that it can (LK202-25)
Well.. let's take a more basic look at this.
First you have to define the custom char...
I'm going to do this in HEX, and then just show the bytes have to be sent.
0xFE //command refix
0x4E //define custom character command
0x00 //custom character value, we are defining 0
0xC //here you just send 8 bytes of the custom character.
0x12 //Here is the degree symbol
0x12
0xC
0x00
0x00
0x00
0x00
Now if you send 0x00 as the char, you will display the degree symbol.
First you have to define the custom char...
I'm going to do this in HEX, and then just show the bytes have to be sent.
0xFE //command refix
0x4E //define custom character command
0x00 //custom character value, we are defining 0
0xC //here you just send 8 bytes of the custom character.
0x12 //Here is the degree symbol
0x12
0xC
0x00
0x00
0x00
0x00
Now if you send 0x00 as the char, you will display the degree symbol.
Henry J.
President
Matrix Orbital
President
Matrix Orbital
-
- LCD?
- Posts: 1
- Joined: Mon Jan 27, 2003 8:28 am
Got it working
Hello,
Thanks for your input, I got it working, silly really. I was setting up the DISPLAY file to write to in a Perl module and setting up the custom characters in another module so it was just a simple case of moving the custom character command over to the module which was setting up the display.
Thanks,
Gareth.
Thanks for your input, I got it working, silly really. I was setting up the DISPLAY file to write to in a Perl module and setting up the custom characters in another module so it was just a simple case of moving the custom character command over to the module which was setting up the display.
Thanks,
Gareth.