Page 1 of 2
Posted: Sun Dec 02, 2001 1:06 am
by xull1x
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.
Posted: Sun Dec 02, 2001 1:09 am
by Henry
depends on the program, some i have source for some I don't... let me know specificaly what you want. All of our software written here is in Borland C++ Builder 5.0, with ZCOMM serial library...
Posted: Sun Dec 02, 2001 1:13 am
by xull1x
doesn't matter. paste any bc code..
i just need to look at sample code snippets to figure out.. how to move the cursor around (ie what ascii char's to pass.. to the serial port).
Posted: Sun Dec 02, 2001 1:15 am
by xull1x
Alpha Demo's source would be nice.
Posted: Sun Dec 02, 2001 1:17 am
by Henry
Turning GPOs on and of, and writing text to the screen
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>
Posted: Sun Dec 02, 2001 1:17 am
by Henry
Clearing the screen:
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>
Posted: Sun Dec 02, 2001 1:18 am
by Henry
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;
}
}
Posted: Sun Dec 02, 2001 1:20 am
by xull1x
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); }
Posted: Sun Dec 02, 2001 1:22 am
by Henry
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>
Posted: Sun Dec 02, 2001 1:25 am
by xull1x
lastly custom characters?

henry.. i'll write you a nice program..
it uses Perl/Tk =)
Posted: Sun Dec 02, 2001 1:29 am
by xull1x
oh i just remembered.. cursor on / off?
Posted: Sun Dec 02, 2001 1:41 am
by Henry
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.
Posted: Sun Dec 02, 2001 1:45 am
by Henry
On 2001-12-02 01:29, xull1x wrote:
oh i just remembered.. cursor on / off?
Cursor Blink On
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.
Posted: Sun Dec 02, 2001 1:49 am
by Henry
BTW, what are you making?
Posted: Sun Dec 02, 2001 2:38 am
by xull1x
a bomb

jk.. just a really good interface.. that works @ 19200 bps.. and does a lot of stuff.. like oscilliscope etc.
it's like the programs out there, but will be better. honestly.. those programmers don't know how to give an lcd the looks
