How do i send DOS commands to my Receipt printer via COM1? [closed]

孤街浪徒 提交于 2019-12-02 10:21:46

Do not enter the Hex-Code. You need the ASCII-Code in Decimal. For example: to write 0xF, you must turn it into decimal (15) after copy con: com1press 'ALT' (keep it pressed) while you enter the decimal value with three digits ( 015 ), then release 'ALT'. Continue with the next value, if it is a command with more than one HexNumber. When finished, press Ctrl-Z.

It may be easyer to use, if you write your "commands" to a textfile, then you can copy them to com1: for example:

copy linefeed com1:

(I have no serial device to test, but it should work)

I tried it with

copy con bell.txt

Then I entered 007 (= 0x07, which is a Bell), Ctrl-Z. This gives a textfile with lenght = 1 byte

Type bell.txt

will then beep.

EDIT "1B" is the Code for a so-called "Escape-Sequence" (a multi-byte-command) "70" is the command itself and it needs three parameters (n, p1, p2). So the complete Sequence is 5 bytes long. You will have to replace "n", "p1" and "p2" with proper numbers. You will find those in the manual of your serial device ("1B" is the Code for a so-called "Escape-Sequence" (a multi-byte-command) "70" is the command itself and as you describe it, it needs three parameters (n, p1, p2). So the complete Sequence is 5 bytes long. You will have to replace "n", "p1" and "p2" with proper numbers. You will find those in the manual of your serial device (http://www.cognitivetpg.com/downloads/189-9200250C.pdf), Page 69. P1 and P2 seem to describe the time, the drawer needs to open/cose) N describes which drawer you talk to.

EDIT2 create one file per command. eg. "open1.bin" "close1.bin" etc. Create them as described in my first answer. You should first try with "simple" commands (one-byte-commands) to verify, that this works ok. To execute the commands, send them to com 1 using copy open1.bin com1:. For multibyte commmands create them with copy con: file.txt Enter first value while you keep "alt" pressed, release "alt", press it again and keep it pressed for the second value and so on.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!