Page 1 of 1
GPO Perl or C code?
Posted: Wed Mar 26, 2003 12:47 pm
by CTMacGyver
Can anyone point me in the direction of some perl or C code for turning the GPOs on or off?
Thanks in advance!
Jim
Posted: Thu Mar 27, 2003 11:06 pm
by Henry
I'm no perl expert (or even close).
First of all, all you have to do is figure out how to send to the serial port. To turn on a GPO you will need to send 2 or 3 bytes depending on what module you have...
0xFE //Command Prefix
0x56 //GPO on command
1 //for GPO #1
pretty simple really, the hard part is getting perl to format the byte properly..
syswrite DisplayIO, sprintf ("%cX", 0xfe) ; # clear LCD
the above is from a perl example in the downloads section. It clears the LCD screen by sending 2 bytes, once hex and one ASCII. That should help too.
Posted: Fri Mar 28, 2003 5:54 am
by CTMacGyver
Thanks for the help.
I haven't had a problem clearing the display or turning the backlight on, but turning on the GPOs or setting the time off for the backlight where it carried the extra byte was confusing me.
I'll post the info here for the next guy.
One of the LCD manuals mentions that the # of the GPO needs to be specified in HEX so:
syswrite DisplayIO, sprintf ("%cW%c", 0xfe, 0x01); #Turns on GPO #1
Jim