code examples.
i'm writing a program in perl. i'm having a hard time.. figuring out all the control codes.
ie. to turn on a black light.. you have to do something like
sub backlighton_lcd { syswrite LH, sprintf ("%cB%c", 254, 0); }
where as LH is a filehandle to your serial port. (254 ascii, B(66 ascii), 0 ascii).
can someone give me examples of similar stuff.. like ie creating custom characters, moving the cursor around, etc.
also henry, where can i find sources to your programs? :-) thanks.
ie. to turn on a black light.. you have to do something like
sub backlighton_lcd { syswrite LH, sprintf ("%cB%c", 254, 0); }
where as LH is a filehandle to your serial port. (254 ascii, B(66 ascii), 0 ascii).
can someone give me examples of similar stuff.. like ie creating custom characters, moving the cursor around, etc.
also henry, where can i find sources to your programs? :-) thanks.
Turning GPOs on and of, and writing text to the screen
_________________
Henry J.
Technical Support
Matrix Orbital
<font size=-1>[ This Message was edited by: Henry on 2001-12-02 01:18 ]</font>
Code: Select all
if (CheckBox1 -> Checked)
{
ZComm1->WriteCommByte(0xfe);
ZComm1->WriteCommByte('W');
ZComm1->WriteCommByte(1); //turns GPO on
ZComm1->WriteCommByte(0xfe);
ZComm1->WriteCommByte('W');
ZComm1->WriteCommByte(2); //turns LED on
ZComm1->WriteCommByte(0xfe);
ZComm1->WriteCommByte('G');
ZComm1->WriteCommByte(1);
ZComm1->WriteCommByte(1);
ZComm1->Text=("Fan #1 [ON] / OFF ");
}
else
{
ZComm1->WriteCommByte(0xfe);
ZComm1->WriteCommByte('V');
ZComm1->WriteCommByte(1); //turns GPO off
ZComm1->WriteCommByte(0xfe);
ZComm1->WriteCommByte('W');
ZComm1->WriteCommByte(2); //turns LED off
ZComm1->WriteCommByte(0xfe);
ZComm1->WriteCommByte('G');
ZComm1->WriteCommByte(1);
ZComm1->WriteCommByte(1);
ZComm1->Text=("Fan #1 ON / [OFF] ");
}
}
Henry J.
Technical Support
Matrix Orbital
<font size=-1>[ This Message was edited by: Henry on 2001-12-02 01:18 ]</font>
Clearing the screen:
_________________
Henry J.
Technical Support
Matrix Orbital
<font size=-1>[ This Message was edited by: Henry on 2001-12-02 01:18 ]</font>
Code: Select all
{
ZComm1->WriteCommByte(0xfe);
ZComm1->WriteCommByte('X');
}
Henry J.
Technical Support
Matrix Orbital
<font size=-1>[ This Message was edited by: Henry on 2001-12-02 01:18 ]</font>
backlight on and off:
Code: Select all
{
static int backlighton = true;
if (backlighton)
{
ZComm1->WriteCommByte(0xfe);
ZComm1->WriteCommByte('F');
backlighton=false;
}
else
{
ZComm1->WriteCommByte(0xfe);
ZComm1->WriteCommByte('B');
ZComm1->WriteCommByte(0);
backlighton=true;
}
}
Henry J.
President
Matrix Orbital
President
Matrix Orbital
cursor moving?
so far i have this:
(note this is perl)
# sub that clears the LCD.
sub clear_lcd { syswrite LH, sprintf ("%c", 12); }
#move the cursor down by a line.
sub cursorbyline_lcd { syswrite LH, sprintf("n"); }
#turn on backlight
sub backlighton_lcd { syswrite LH, sprintf ("%cB%c", 254, 0); }
#turn off backlight
sub backlightoff_lcd { syswrite LH, sprintf ("%cF", 254); }

(note this is perl)
# sub that clears the LCD.
sub clear_lcd { syswrite LH, sprintf ("%c", 12); }
#move the cursor down by a line.
sub cursorbyline_lcd { syswrite LH, sprintf("n"); }
#turn on backlight
sub backlighton_lcd { syswrite LH, sprintf ("%cB%c", 254, 0); }
#turn off backlight
sub backlightoff_lcd { syswrite LH, sprintf ("%cF", 254); }
Cursor Left
ASCII 'L', Hex 4C, Decimal 76
Syntax 0xFE 0x4C
To move the cursor one space to the left of current position, send a command prefix followed by the character 'L'.
Cursor Right
ASCII 'M', Hex 4D, Decimal 77
Syntax 0xFE x04D
Go To Position
ASCII 'G', Hex 47, Decimal 71
Syntax 0xFE 0x47<column number><row number>
To set the current cursor position, send a command prefix followed by the character 'G' and two values defining the column and row of the desired cursor position. Example:
<command prefix> 0xFE
<command> 0x47
<column number> 0x01 to 0x14 for a twenty column display
<row number> 0x01 to 0x04 for a four line display
Go To Top Left
ASCII 'H', Hex 48, Decimal 72
Syntax 0xFE 0x48
This command resets the current cursor position to the top left of the LK screen. To execute this command send a command prefix followed by character 'H'.
_________________
Henry J.
Technical Support
Matrix Orbital
<font size=-1>[ This Message was edited by: Henry on 2001-12-02 01:26 ]</font>
ASCII 'L', Hex 4C, Decimal 76
Syntax 0xFE 0x4C
To move the cursor one space to the left of current position, send a command prefix followed by the character 'L'.
Cursor Right
ASCII 'M', Hex 4D, Decimal 77
Syntax 0xFE x04D
Go To Position
ASCII 'G', Hex 47, Decimal 71
Syntax 0xFE 0x47<column number><row number>
To set the current cursor position, send a command prefix followed by the character 'G' and two values defining the column and row of the desired cursor position. Example:
<command prefix> 0xFE
<command> 0x47
<column number> 0x01 to 0x14 for a twenty column display
<row number> 0x01 to 0x04 for a four line display
Go To Top Left
ASCII 'H', Hex 48, Decimal 72
Syntax 0xFE 0x48
This command resets the current cursor position to the top left of the LK screen. To execute this command send a command prefix followed by character 'H'.
_________________
Henry J.
Technical Support
Matrix Orbital
<font size=-1>[ This Message was edited by: Henry on 2001-12-02 01:26 ]</font>
ok, this is a tad harder... but here it goes...
0xFE //command prefix
0x4E //this starts the custom characters
0x00 //0x00 to 0x07 for 8 custom characters.
0xC //here you just send 8 bytes of the custom character.
0x12 //Here is the degree symbol
0x12
0xC
0x00
0x00
0x00
0x00
ok, now it is defined.
so any time you need to display the character you send our 0x00 for the first custom character. 0x01, 0x02 and so on for the other. You only need to do the define once, then you just type the custom character. That simple.
0xFE //command prefix
0x4E //this starts the custom characters
0x00 //0x00 to 0x07 for 8 custom characters.
0xC //here you just send 8 bytes of the custom character.
0x12 //Here is the degree symbol
0x12
0xC
0x00
0x00
0x00
0x00
ok, now it is defined.
so any time you need to display the character you send our 0x00 for the first custom character. 0x01, 0x02 and so on for the other. You only need to do the define once, then you just type the custom character. That simple.
Henry J.
President
Matrix Orbital
President
Matrix Orbital
Cursor Blink OnOn 2001-12-02 01:29, xull1x wrote:
oh i just remembered.. cursor on / off?
ASCII 'S', Hex 53, Decimal 83
Syntax 0xFE 0x53
To turn on the blinking cursor at the current position, send a command prefix followed by the character 'S'. Please note that the blinking cursor is on by default at power up.
Cursor Blink Off
ASCII 'T', Hex 54, Decimal 84
Syntax 0xFE 0x54
To turn off the blinking cursor at the current position send a command prefix followed by the character 'T'.
Just check any of the manuals for the command set... some units have more then others, depending on the fetures of the specific display.
Henry J.
President
Matrix Orbital
President
Matrix Orbital