The text of a manual · part 8 of 9
PT630 Portable Terminal Programming Reference Guide: MULTIPOINT Communication
Pages 59 to 70 of 73, from PT630 Portable Terminal Programming Reference Guide
The original document is the PDF (2.0 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Unitech PT630
Page 59
PT630 Programming Reference Guide Page 59 of 59 ------------------------------------------------------------------------------------------------------------------
Chapter 2.
MULTIPOINT Communication
2.1 MULTIPOINT Communication Protocol MULTIPOINT communication protocol is supported by built-in communication tool on PT630. It is the default setting for RS232 port. User can enable/disable MULTIPOINT protocols by keypad setting or system call in the application. If RS232 port is set to NONE communication protocol, that means MULTIPOINT protocol is disabled and the application can treat RS232 port as a character I/O device like COM ports on PC. Otherwise, the MULTIPOINT is active and PT630 will interpret RS232 input data as on-line commands from host computer and send data to host computer in data packet according to MULTIPOINT protocol. MULTIPOINT protocol is an asynchronous serial multi-drop protocol for communication with the host computer. One host computer can be connected up to 32 PT630 terminals, while each PT630 has a unique address. The address is an ASCII character ( ‘A’ – ‘Y’ or ‘0’ – ‘6’) plus 80H. In MULTIPOINT protocol, host computer always issues POLLING DATA request or ESC commands first, then wait for the addressed PT630 to response. The maximum packet size including protocol control characters is 256 bytes. 2.1.1
Symbols in Transmission Packet STX = 02H ETX = 03H EOT = 04H ACK = 06H NAK = 15H ESC = 1BH CMD = command character ADDR = address (‘A’ – ‘Y’ or ‘0’ – ‘6’) + 80H CS1 CS2= 2 checksum characters <data>/<parameters> = character string
2.1.2
Fast checking whether terminal is on-line ( BELL) Format: ⇒ BELL ADDR ;<addr>=‘A’~’Y’ or ’0’~’6’ ⇐ STX ESC BELL ‘63’ ETX ; ; = 01H error ⇒ ACK or NAK Description:
The command will change PT630 MULTIPOINT address.
Page 60
PT630 Programming Reference Guide Page 60 of 59 -----------------------------------------------------------------------------------------------------------------2.1.3
2.1.4
Host Transmission Packet Transmission
Format
Poll Host Data Host Command Acknowledgement Negative ACK
STX ADDR STX ESC ‘0’ <data> CS1 CS2 ADDR STX ESC CMD <parameters> CS1 CS2 ADDR ACK NAK
PT630 Transmissions Packet Transmission
Format
Terminal Data Terminal No Data Terminal response Acknowledgement Negative ACK
STX <data> CS1 CS2 ETX EOT STX CMD <parameters> CS1 CS2 ETX ACK NAK
2.1.5 Data Conversion Rules in Packet 1) One-byte data converted to two-byte data: \ convert to \\ 00 hex -- 1F hex convert to \ 80 hex -- \ 9F hex A0 hex -- FF hex convert to \ 20 hex -- \ 7F hex (excluding DC hex) 2)
One-byte data transmitted as original data without converting all codes not in 1) (including DC hex)
2.1.6 Data Checksum Calculation in Packet 1) CS =[sum of all characters (excluding STX and ETX) + packet length (excluding STX and ADDR/ETX)] MOD 256 2) CS1 = high nibble of CS + 40H 3) CS2 = low nibble of CS + 40H 2.1.7
Example packet of command to send the file named A.EXE to PT630 with address ‘A’
Packet: STX ESC CMD <parameters> CS1 CS2 ADDR CMD = ‘L’ <parameters> = “A . E X E “ Packet length = total characters of ESC, CMD and <parameters> = 7 ADDR = ‘A’ + 80H = C1H CS = [(ESC+‘L’+‘A’+’.’+’E’+’X’+’E’+ADDR)+Packet length] MOD 256 = [(1BH+4CH+41H+2EH+45H+58H+45H+C1H)+7] MOD 256 = 80H CS1 = high nibble of CS + 40H = 08H + 40H = 48H CS2 = low nibble of CS + 40H = 00H + 40H = 40H
Page 61
PT630 Programming Reference Guide Page 61 of 59 -----------------------------------------------------------------------------------------------------------------Example Packet in Hex Format: STX ESC CMD <parameters> CS1 CS2 ADDR 02H 1BH 4CH 41H 2EH 45H 58H 45H 48H 40H C1H
Page 62
PT630 Programming Reference Guide Page 62 of 59 -----------------------------------------------------------------------------------------------------------------2.2 Data Communication in MULTIPOINT Protocol 2.2.1 Host Send Data to PT630 (ESC 0) Format :
Æ Å
STX ESC ‘0’ <data> CS1 CS2 ADDR ACK or NAK
Description: PT630 will put the received data in the buffer. The application on PT630 can: Use system call INT 21H/AH=5CH to get data. Use system call INT 21H/AH=5EH to check the buffer status. 2.2.2
Host Requests Data from the PT630 ( Polling )
Format
Æ STX ADDR Å EOT Or Å STX <data> CS1 CS2 ETX
; polling ; if PT630 has no data to send ; if there is data in PT630 buffer
Description: The application on PT630 uses system call INT 21H/AH= 5DH to put data in buffer. Once polled by host computer, PT630 system will send data out.
2.3 File Communication in MULTIPOINT Protocol 2.3.1
Host Send File to PT630 ( Download )
Format : ⇒ STX ESC ‘L’ <filename> CS1 CS2 ADDR ⇐ ACK or NAK ; if NAK, retry or abort the command ⇒ STX ESC ‘Y’ <data> CS1 CS2 ADDR ⇐ ACK or NAK ⇒ STX ESC ‘Z’ CS1 CS2 ADDR ⇐ ACK or NAK
; if ACK, loops until file is transmitted ; if NAK, send the packet again
; end of file transfer
Description: The download command is used to send binary executable program (*.exe file) or data file from host system to the PT630. When the PT630 receives the download command it sends an ACK response back to the host and immediately put itself into file receiving state. The host system may start transmission of the file as soon as the ACK response has arrived.
Page 63
PT630 Programming Reference Guide Page 63 of 59 -----------------------------------------------------------------------------------------------------------------2.3.2 Host Send File to PT630 ( Download ) from specified file position ⇒ STX ESC ‘L’ <filename> [offset] CS1 CS2 ADDR ⇐ ACK or NAK ; if NAK, retry or abort the command ⇒ STX ESC ‘Y’ <data> CS1 CS2 ADDR ⇐ ACK or NAK ⇒ STX ESC ‘Z’ CS1 CS2 ADDR ⇐ ACK or NAK
; if ACK, loops until file is transmitted ; if NAK, send the packet again
; end of file transfer
Note : [offset] mean file’s starting pointer. [offset] E.x. [1000] mean to start download specified file from 1000st bytes. 2.3.3
Cancel Current Downloading File Command (ESC z) Format: ⇒ STX ESC ‘z’ CS1 CS2 ADDR ⇐ ACK or NAK
2.3.4 Host Requests File from the PT630 ( Upload ) Format: ⇒ STX ESC ‘U’ <filename> CS1 CS2 ADDR ⇐ ACK or NAK ; if NAK, retry or abort ⇒ STX ESC ‘Y’ CS1 CS2 ADDR ⇐ STX ESC ‘Y’ <data> CS1 CS2 ETX ⇒ ACK or NAK
; loops until ESC ‘Z’ is ; received
⇐ STX ESC ‘Z’ CS1 CS2 ETX ⇒ ACK or NAK
; end of file transfer
Description: For uploading, the host must know the filename on PT630. Get Directory Command (ESC ‘D’) can be used to view all filenames on PT630 (see 4.4 Host Commands). 2.3.5 Host Requests File from the PT630 ( Upload ) from specified file positon Format: ⇒ STX ESC ‘U’ <filename> [offset] CS1 CS2 ADDR ⇐ ACK or NAK ; if NAK, retry or abort ⇒ STX ESC ‘Y’ CS1 CS2 ADDR ⇐ STX ESC ‘Y’ <data> CS1 CS2 ETX ⇒ ACK or NAK
; loops until ESC ‘Z’ is ; received
⇐ STX ESC ‘Z’ CS1 CS2 ETX ; end of file transfer ⇒ ACK or NAK Note : [offset] mean file’s starting pointer. [offset] E.x. [1000] mean to start download specified file from 1000st bytes. Description: For uploading, the host must know the filename on PT630. Get Directory Command (ESC ‘D’) can be used to view all filenames on PT630 (see 4.4 Host Commands). 2.3.6
Cancel Current Uploading File Command (ESC y)
Format: ⇒ STX ESC ‘y’ CS1 CS2 ADDR ⇐ ACK or NAK
Page 64
PT630 Programming Reference Guide Page 64 of 59 ------------------------------------------------------------------------------------------------------------------
2.4 Host Commands 2.4.1 Set MULTIPOINT Address ( ESC 5) Format: ⇒ STX ESC ‘5’ <addr> CS1 CS2 ADDR ⇐ STX ESC ‘5’ <retcode> CS1 CS2 ETX
;<addr>=‘A’~’Y’ or ’0’~’6’ ;<retcode>= 00H successful ; = 01H error
⇒ ACK or NAK Description: 2.4.2
The command will change PT630 MULTIPOINT address.
Warm Start Format:
( ESC A ) ⇒ STX ESC ‘A’ CS1 CS2 ADDR ⇐ ACK or NAK
Description: The command causes PT630 stop program execution and return to Ready Mode. Programs and data that have been stored in the PT630 RAM space are preserved. The system parameters remain unchanged. The equivalent keypad invoking sequence is pressing CMD and then the ALPHA key. 2.4.3
Enable/Disable Barcode Symbologies Format:
( ESC B )
⇒ STX ESC ‘B’ <C1 C2 C3 C4 C5 C6 C7 C8> CS1 CS2 ADDR C1 = ‘E’ Enable Code 39 ‘F’ Enable Code 39 full ASCII ‘D’ Disable Code 39 C2 - C8 = ‘E’ Enable Interleaved 2 of 5, Codabar, UPC/EAN, Code 128, EAN 128, Code 93, Trioptic Code respectively ‘D’ Disable ⇐ STX ESC ‘B’ <retcode>CS1 CS2 ETX ;<retcode>= 00H successful ; 01H error ⇒ ACK or NAK
Page 65
PT630 Programming Reference Guide Page 65 of 59 -----------------------------------------------------------------------------------------------------------------2.4.4
Communication Configuration
( ESC C )
Format: ⇒ STX ESC ‘C’ <comtable> CS1 CS2 ADDR ⇐ STX ESC ‘C ‘ <retcode> CS1 CS2 ETX ;<retcode>= 00H successful ; 01H error ⇒ ACK or NAK Description:
The command writes <comtable> to PT630 communication control table.
<comtable> is defined as: typedef strut { char baud_rate;
// ‘0’~’9’/‘A’: 110/150/300/600/1200/2400 // 4800/9600/ 9200/38400/57600 char stop_bit, // ‘1’/’2’: 1/2 stop bits char data_bit // ‘7’/’8’: 7/8 data bits char parity; // ‘N’/’O’/’P’: None/Odd /Even parity char flow_control; // ‘X’/’C’/’F’: XON XOFF/RTS CTS/NONE char protocol; // ‘M’/’F’ MULTIPOINT/None char address // ‘A’~’Y’ or ‘0’~’6’ char reserved; char reserved; char timeout ; // communication time-out } comtable;
The new communication control table takes effect immediately after the command has been successfully received. The PT630 will reinitialize the corresponding communication port with its new parameters. For Example, if the command instructs the RS-232 port to change the baud rate from 9600 to 1200 the PT630 will switch to 1200 right after the command has been received. The next host communication will use 1200 baud rate. 2.4.5
Get Format:
File Directory in RAM Disk ( ESC D )
⇒ STX ESC ‘D’ CS1 CS2 ADDR ⇐ STX ESC ‘D’ <filename,filename…> CS1 CS2 ETX ⇒ ACK or NAK if If the last character of <filename,filename…> is it mean directory list is too big for single packet. Please issue ESC D command again ⇒ STX ESC ‘D’ CS1 CS2 ADDR ⇐ STX ESC ‘D’ <filename,filename…> CS1 CS2 ETX ⇒ ACK or NAK
Description:
PT630 will send its file directory to the host.
Page 66
PT630 Programming Reference Guide Page 66 of 59 -----------------------------------------------------------------------------------------------------------------2.4.6
Get Program Name in FLASH Memory (ESC D/ROM) ⇒ STX ESC ‘D/ROM’ CS1 CS2 ADDR ⇐ STX ESC ‘D’ <program-name,program-name…> CS1 CS2 ETX ⇒ ACK or NAK
Format:
Description: 2.4.7
PT630 will send program names in FLASH memory to the host.
Erase File ( ESC E ) Format:
⇒ STX ESC ‘E’ <filename> CS1 CS2 ADDR ⇐ STX ESC ‘E’ <retcode> CS1 CS2 ETX
;<retcode>=00H successful ; 01H error
⇒ ACK or NAK Description: Used to erase file in PT630. 2.4.8
Change EXEC Area Size (ESC F) Format:
⇒ STX ESC ‘F’ <nnn> CS1 CS2 ADDR ; <nnn>: 3 digits in ASCII ⇐ STX ESC ‘F’ <retcode> CS1 CS2 ETX ; <retcode>= 00H successful ; 01H can’t change ; 02H invalid value ⇒ ACK or NAK
Description: If PT630 RAM disk has files, its size can’t be changed (<retcode>=01H). 2.4.9
Get RAM Memory Configuration (ESC G) Format:
2.4.10
Get FLASH Memory Configuration (ESC G/ROM)
Format:
2.4.11
⇒ STX ESC ‘G’ CS1 CS2 ADDR ⇐ STX ESC ‘G’ <s1><s2><s3> CS1 CS2 ETX ; <s1> total RAM memory size in 4 ASCII digits ; <s2> EXEC memory size in 4 ASCII digits ; <s3> free memory size in 4 ASCII digits ⇒ ACK or NAK
⇒ STX ESC ‘G/ROM’ CS1 CS2 ADDR ⇐ STX ESC ‘G’ <s1><s2>CS1 CS2 ETX ; <s1> total FLASH memory size in 4 ASCII digits ; <s2> free FLASH memory size in 4 ASCII digits ⇒ ACK or NAK
Cold
Start ( ESC H )
Page 67
PT630 Programming Reference Guide Page 67 of 59 -----------------------------------------------------------------------------------------------------------------Format: ⇒ STX ESC ‘H’ CS1 CS2 ADDR ⇐ ACK or NAK Description: The command clears all PT630 RAM memory content. It performs tests on all major hardware devices. Programs or data that have previously accumulated in the PT630 or previously been downloaded by the host will be purged from the memory. Default system parameters are restored from the EPROM. 2.4.12
Get the Name of Current Running Program (ESC I) Format:
2.4.13
⇒ STX ESC ‘I’ CS1 CS2 ADDR ⇐ STX ESC ‘I’ <prg-name> CS1 CS2 ETX ; if RAM program is running or ⇐ STX ESC ‘I’ <prg-name/ROM> CS1 CS2 ETX ; if FLASH program is running or ⇐ STX ESC ‘I’ <retcode> CS1 CS2 ETX ; if no program is running <retcode> = 01H ⇒ ACK or NAK
Check whether File/Program Exists (ESC J) Format:
⇒ STX ESC ‘J’ <filename> CS1 CS2 ADDR ⇐ STX ESC ‘J’ <retcode><length> CS1 CS2 ETX ;<retcode>=0 file in RAM ; 1 no file ; 2 file in FLASH ; <length> : string if <retcode>=0 or 2. ⇒ ACK or NAK
2.4.14
Enter Kermit Server Mode (ESC k) Format:
⇒ STX ESC ‘k’ CS1 CS2 ADDR ⇐ ACK or NAK
Description: PT630 will enter Kermit Server Mode if the command is received. The MULTIPOINT protocol will be disabled until BYE or EXIT command is issued in Kermit Server Mode.
Page 68
PT630 Programming Reference Guide Page 68 of 59 -----------------------------------------------------------------------------------------------------------------2.4.15
Set
Date/Time
( ESC M )
Format: ⇒ STX ESC ‘M’<datetime> CS1 CS2 ADDR
;<datetime>=ASCII string ; in “yyyymmddhhmmss” ⇐ STX ESC’ M’ <retcode> CS1 CS2 ETX ;<retcode>= 00H success ; 01H error ⇒ ACK or NAK Description: This command allows the host system to set PT630 real time clock. The parameter <datetime> is an ASCII character string. The first four characters represent the year. The next two characters represent the month. The fields after the month field represent the day of the month, hour (24-hour format), minute, and second, respectively. For Example, string “19900926234500” will set PT630 clock to September 26, 1990. The time is 11:45 PM. The PT630 reconfigures the real time clock chip as soon as the command has been successfully received. 2.4.16
Set Buzzer Volume (ESC N)
Format: ⇒ STX ESC ‘N’ <n> CS1 CS2 ADDR
; <n>=‘0’ low volume ; ‘5’ medium volume ; ‘9’ high volume
⇐ ACK or NAK 2.4.17
Change Password ( ESC P )
Format: ⇒ STX ESC ‘P’<password>CS1 CS2 ADDR ⇐ STX ESC ‘P’ <retcode> CS1 CS2 ETX
; <password> 10 characters ; maximum ; <retcode>=00H success ; 01H error
⇒ ACK or NAK Description: The command changes the password for PT630 Supervisor Mode. 2.4.18
Get Terminal ID (ESC R)
Format:
⇒ STX ESC ‘R’ CS1 CS2 ADDR ⇐ STX ESC ‘R’ <ID> CS1 CS2 ETX ⇒ ACK or NAK
Description:
<ID> is 8-characters fixed length string and its default value is “PT630”.
Page 69
PT630 Programming Reference Guide Page 69 of 59 -----------------------------------------------------------------------------------------------------------------2.4.19
Terminal Mode Configuration ( ESC T ) ⇒ STX ESC ‘T’ <termtable> CS1 CS2 ADDR ⇐ STX ESC ‘T’ <retcode> CS1 CS2 ETX ;<retcode>=00H success ; 01H error ⇒ ACK or NAK Description: The command set the configuration for PT630 Terminal Mode. <termtable> is defined as: typedef struct { char id[8]; // terminal ID = fixed 8 characters string char online; // ‘R’ /’ L’ = remote / local char echo; // ‘N’ /’ F’ =echo on / echo off char autolf; // ‘N’ / ‘F’ =autoLF / no autoLF char mode; // ‘C’ /’ B’ =character / block mode char linepage; // ‘L’ /’ P’ / ‘B’ = block defined as line / page / both char lineterm; // line mode terminator character char pageterm; // page mode terminator character } termtable; Format:
The new terminal control table takes effect immediately after the command has been successfully received. 2.4.20
Device Configuration Format:
Description:
( ESC V )
⇒ STX ESC ‘V’ <devtable> CS1 CS2 ADDR ⇐ STX ESC ‘V’ <retcode> CS1 CS2 ETX ;<retcode>=00H success ; 01H error ⇒ ACK or NAK The command sets configuration of PT630 device control table.
<devtable> is defined as: typedef struct { char scanner_type; // ‘P’ /‘A’/‘D’ = Pen/Auto/Disable char lcd_backlit; // ‘N’ / ‘F’ = LCD backlight ON /OFF char buzzer; // ‘N’ /‘F’ = Buzzer ON /OFF char reserved; char beepvol; // ‘0’ /‘5’ /‘9’ = Vol. Low/Medium/High char serial_port; // ‘N’ /‘F’ = RS232 port Enable/Disable char auto_off; // ‘0’ = disable auto-off // ‘1’ ~ ‘9’ auto-off timer (1~9 minutes) char reserved; } devtable; The new device control table takes effect immediately after the command has been successfully received.
Page 70
PT630 Programming Reference Guide Page 70 of 59 -----------------------------------------------------------------------------------------------------------------2.4.21 Get Portable Model Number and BIOS Version Number (ESC v) Format:
⇒ STX ESC ‘v’ CS1 CS2 ADDR ⇐ STX ESC ‘v’ ‘PT630 V5.00’ CS1 CS2 ETX ⇒ ACK or NAK
Description: The model and BIOS version numbers are separated by a space character. 2.4.22
Run Program in RAM or FLASH memory ( ESC X ) Format:
2.4.23
⇒ STX ESC X <prg-name> CS1 CS2 ADDR ⇐ STX ESC X <retcode> CS1 CS2 ETX ;<retcode>=00H run from RAM ; 01H no program ; 02H run from FLASH ⇒ ACK or NAK
Run Program in FLASH memory (ESC X/ROM) Format:
⇒ STX ESC X <prg-name/ROM> CS1 CS2 ADDR ⇐ STX ESC X <retcode> CS1 CS2 ETX ;<retcode>=01H no program ;
⇒ ACK or NAK 2.4.24
Bell – An easy way to check whether terminal is on-line (Bell) Format:
⇒ Bell ADDR ⇐ STX ETX
02H run from FLASH