-
9
-
4
.2.I/O operation
①
Output to the port
Port output (1 byte)
It will set the data to the output port when the data is received from the computer
by ”W” command. It will return “OK” to the computer when the data will be set to the
output port.
Bit output
It will set the data to the specified bit when the data is received from the computer by
“O” command. It will return “OK” to the computer when the data will be set to the
specified bit.
②
Input from the port
Port input
When ZS-6216E will be received “R” command from the computer, capture the data
from the input port and return it to the computer.
4.3.Command table
ZS-6216E recognizes the 1
st
byte of the data as the control command and control it.
It has to attach a delimiter (CR+LF) on the end of data when send the data.
It will be returned “NG” if the 1
st
byte of the data should not be as a command.
Command
Function
R
Read the data from the input port.
W
Write the data to the output port.
O (ON)
Specified bit on the output port will be “ON” (Hi).
O (OF)
Specified bit on the output port will be “OFF” (Low).
4.3.1. R command
Function
Read the data from the input port. The return is 2 bytes, the order is high and low.
Format
R
CR LF
Return value
xx
CR LF
:
It will be received 2 bytes of input port data.
“x” is ASCII code from 0 to F.
NG
CR LF
:
Recognition error of command or data.
Example
Send
:
R
CR LF
Reply
:
01
CR LF
(IN1 is ON , from IN2 to 8 are OFF)