Controlling backlight

Mur

New member
To amuse myself, I'm trying to learn how to control the 20x4 crystalfontz lcd myself. At the moment I'm using Perl, as it's a quick language. Anyway, I can't for the life of me figure out how to control the backlight... Sample program:

#!/usr/bin/perl
use FileHandle;

open (LCD, ">/dev/ttyS0");
LCD->autoflush();

sleep(3);

print LCD "Hello World";
print LCD "\014\020"; # back light to 20% .. from .pdf

sleep(6);

close (LCD);
exit 0;

Obviously, the syntax that I'm using must not be correct. Does anyone have any suggestions?
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 

CF Tech

Administrator
The "\xxx' (where xxx = 000 to 255) is just a notation used in WinTest and the data sheet for a "binary" number.

So "\013" is a single byte with a value of:

13 decimal
0x0D hex
"CR" ASCII

So the trick will be figuring out how to talk Perl into sending an arbitrary value byte out the serial port, then use that sequence every time you see the \xxx.
 
Top