The American Standard Code for Information Interchange (ASCII) is a character-encoding scheme based on the ordering of the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text. Most modern character-encoding schemes are based on ASCII.
https://www.rapidtables.com/code/text/ascii-table.html
An ASCII protocol is used on the existing RS232-HOST. To be compatible with existing driver software the ASCII protocol is available.
A basic data link message is coded in ASCII as follows:
length | node | data | |||||
: | len1 | len2 | node1 | node2 | data1 | data1 | CR |
Byte | Explanation |
: | Initial character (colon) |
Len1,Len2 | Length of message including the node address in bytes, so (len1, len2) is the basic message length +1. |
node1,node2 | node address of destination (PC to HOST) node address of source (HOST to PC) |
data1, data2 | message field |
CR | termination character |
3.9.5 Collection of ProPar ASCII examples
hexadecimal 7D00 = decimal 32000
hexadecimal 3E80 = decimal 16000
Float numbers are in 32-bit Single-precision floating-point format(IEEE-754), e.g. float 3F800000=dec 1
Strings contains ASCII characters e.g. hex 41 is character A, hex 4D = M, hex 6D = m , etc
Control mode: read , Process: 1, Parameter: 4, Type: character
Send :06800401040104\r\n
Answer(example) :058002010401\r\n
Value = 01 ( Control mode = “Analog input”)
Control mode: write value = 0 , Process: 1, Parameter: 4, Type: character
Send :058001010400\r\n
Answer(example) :0480000004\r\n
Status : 00 (No error) switch to RS232 mode
The code below will convert the decimal value d to hexadecimal. It also allows you to add padding to the hexadecimal result. So 0 will become 00 by default.
function decimalToHex(d, padding) { var hex = Number(d).toString(16); padding = typeof (padding) === "undefined" || padding === null ? padding = 2 : padding; while (hex.length < padding) { hex = "0" + hex; } return hex; }
capacity unit: read, Process: 1, Parameter: 31, Type: string [7]
Request :078004017F017F07\r\n
Answer(example) :0C8002017F076B672F68202020\r\n
Capacity unit = 6B672F68202020 = kg/h
setpoint: read, Process: 1, Parameter: 1, Type: integer
Request :06800401210121\r\n
Answer(example) :06800201217D00\r\n
measure = hex 7D00 = 32000 = 100%
setpoint: write, value = hex 7D00 = 32000 = 100%
Send :06800101217D00\r\n
Answer(example) :0480000005\r\n
Status : 00 (No error)
measure: read, Process: 1, Parameter: 0, Type: integer
Request :06800401210120\r\n
Answer(example) :06800201217D00\r\n
measure = hex 7D00 = 32000 = 100%