sending hexadecimal control characters, how to?

Sarah Reichelt sarah.reichelt at gmail.com
Thu Dec 3 18:17:41 EST 2009


On Thu, Dec 3, 2009 at 9:03 PM, Peter Alcibiades
<palcibiades-first at yahoo.co.uk> wrote:
>
> Sarah, brilliant!  It is indeed a receipt printer.  So do you maybe know how
> to do the next part?  In order to activate the paper cutter on it, one
> is supposed to do this to trigger the auto cutter drive:
>
> <ESC> “d” “0” or <ESC> “d” <0>
> (1B)H (64)H (30)H or (1B)H (64)H (00)H
> <ESC> “d” “1” or <ESC> “d” <1>
> (1B)H (64)H (31)H or (1B)H (64)H (01)H

Looking at my old scripts, I see stuff like this for setting up the
receipt printer:

    get printSend(numToChar(27) & "@")     -- reset
    get printSend(numToChar(27) & "1")      -- 8 dot line spacing
    get printSend(numToChar(27) & numToChar(32) & numToChar(1))

where the printSend function did the actual communications to the printer.


So in your case, I would try sending:
    numToChar(27) & "d0"
and seeing if this works.

If it doesn't, then try these:
    numToChar(27) & "d" & "0"
    numToChar(27) & "d" & numToChar(32) & "0"

If it still doesn't work, try
    numToChar(27) & numToChar(100) & numToChar(48)

One other thing to check is if the command needs to be ended with a
line feed and if so, which one. The usual options are numToChar(10),
numToChar(13) and CRLF.

You have 2 commands: ESC d 0 and ESC d 1
Do these need to be sent in sequence? Maybe one moves the cutter
across and the other brings it back.
If so, you may need to experiment with timing to work out how long to
leave between commands.
But as far as the communications go, if you can work out the technique
for any command, you can apply that to all the printer features.

Cheers,
Sarah



More information about the use-livecode mailing list