cotede2
Posts: 7
Joined: Tue May 05, 2009 2:55 pm

send ESC + 'h' to the printer

Mon May 18, 2009 8:22 pm

Hello ,
I need to send some special data to the printer.

The printer has to receive these characters :

ESC (0x1b) 'h' (0x68)
How can I do that?

If I do directly Port.Write("0x1b0x68"); does not work
If I do directly Port.Write(ByteArrayToString("{&H1b , &H68)"); does not work either
Port.Write("0001101101101000"); does not work
Port.Write(0x1b);
Port.Write(0x68);
does not work
Same thing for

var T_Byte = new Array();
T_Byte = ["&H1b", "&H68"];
Port.Write(Port.ByteArrayToString(T_Byte));


By does not working , I mean when I do a Port.Read(0,5000) , I get a null as return.


I have already tested the printer return status with ZPL (I work with CPCL now) and it worked.
When I use a program and I send the ESC + 'h' I get an answer so it should communicate .

Thank you to help me.
I have read also your documentation online : http://franson.com/serialtools/referenc ... form=wince

cotede2
Posts: 7
Joined: Tue May 05, 2009 2:55 pm

RE: send ESC + 'h' to the printer

Mon May 18, 2009 9:35 pm

http://diaporama.ppt.free.fr/docs/

the documentation of the printer and the pocket browser.
check CPCL !

User avatar
johan
GpsGate
Posts: 14372
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: send ESC + 'h' to the printer

Tue May 19, 2009 12:52 pm

Javascript has a "C-style" way of including non printable characters into strings. You write a "\" + an ascii value.

In your case
Port.Write('\033\150');

(octal) 033 == (hex) 1B
(octal) 150 == (hex) 68

Regards,
Johan

Franson Support

cotede2
Posts: 7
Joined: Tue May 05, 2009 2:55 pm

RE: send ESC + 'h' to the printer

Tue May 19, 2009 1:23 pm

thank you for your help.
The machin responds null.

Code: Select all

Port.ComPort = "1";
Port.Baudrate = 115200;
Port.Enabled = true;
Port.Write('\033\104');
document.serialdata.read_data.value = Port.Read(0, 5000);

User avatar
johan
GpsGate
Posts: 14372
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: send ESC + 'h' to the printer

Tue May 19, 2009 1:31 pm

Correction. Should be '\033\150'. You find a ascii table here:
http://asciitable.com/

Regards,
Johan

Franson Support

Return to “SerialTools”