User`s manual
BL160054 s System Development
RS-485 Network Software Support
void op
_
init
_
z1( char baud, char *rbuf,
byte address )
Initializes Z180 Port 1 for RS-485 9th-bit binary communication. The
data format defaults to 8 bits, no parity, 1 stop bit.
PARAMETERS: baud selects the baud rate in multiples of 1200 bps
(specify 16 for 19,200 bps).
rbuf is the receive buffer.
address is the network address of the board: 0 for the master board.
1255 for slaves.
int check
_
opto
_
command()
Checks for a valid and completed command or reply in the receive
buffer.
RETURN VALUE:
0 if there is no completed command or message available.
1 if there is a completed command or reply available.
2 if the completed command or reply has a bad CRC check.
int sendOp22( byte dest, char *message,
byte len, int delays )
Sends a message to the slave and waits for a reply. The function puts
the message in the following format.
[slave id] [len+2] [ ] [ ]...[ ] [CRC hi][CRC lo]
PARAMETERS: dest is the slave destination (1255).
message is the message.
len is the length of the message not including the two CRC bytes. The
maximum message length is 251 bytes.
delays is the number of delays to wait for the slave reply. Each delay
is ~50 ms if the real-time kernel (RTK) is used. If the RTK is not used,
the software-generated delay is approximately 50 ms.
RETURN VALUE:
1 if there is no reply from the slave.
2 if a completed reply has a bad CRC.
1 if there is a completed reply with a proper CRC.
The slaves reply is stored in the receive buffer initialized with
op
_
init
_
z1().