11
5.4. Command list
The ZS-6222A recognizes the first byte of data as a control command and controls it.
Also, be sure to add a delimiter (CR+LF) at the end of the data string before sending.
If there is a character string other than the command at the beginning of the data, NG will be
sent as the return value.
The commands are as follows.
command
function
R
Reads data from all ports set as inputs
W
Writes data to a port set to output
T
Output pulse from TRG signal
C
Output pulse from CLR signal
D
Configure port input/output settings
P
Sets the pulse width of the control signal
L
Sets the presence or absence of the latch circuit
U
Set the output signal
B
Sets the positive/negative logic of the port
5.4.1. R command
function
Data is read from all ports that are set as inputs. For example, if 4 input ports are
set, the "R" command will send 8 bytes of data from the ZS-6222A.
format
R
CR LF
return value
xxxx
・・・
CR LF
: The number of data set in the input port is sent.
x is an ASCII code from 0 to F
NG
CR LF
: No input port
5.4.2. W command
function
Data is written to the ports set for output.
For example, if four output ports are set, the "W" command is followed by 8 bytes of
data to be sent to the ZS-6222A.
If less than 8 bytes of data is sent, the amount of data sent will be newly changed,
and the previous data will be retained in the missing parts.
format
Wxxxx
・・・
CR LF
: Write the data to be output to the output port after "W"
x is an ASCII code from 0 to F
return value
OK
CR LF
: Completion of data output to the output port
NG
CR LF
: No output port, wrong data character error