AR-B1375/AR-B1376 User
’
s Guide
11-1
11. PROGRAMMING RS-485 & INDEX
11.1 PROGRAMMING RS-485
The majority communicative operation of the RS-485 is in the same of the RS-232. When the RS-485 proceeds
the transmission which needs control the TXC signal, and the installing steps are as follows:
Step 1:
Enable TXC
Step 2:
Send out data
Step 3:
Waiting for data empty
Step 4:
Disable TXC
NOTE:
Please refer to the section of the “Serial Port” in the chapter “System Control” for the detail description of
the COM port’s register.
(1) Initialize COM port
Step 1:
Initialize COM port in the receiver interrupt mode, and /or transmitter interrupt mode. (All of the
communication protocol buses of the RS-485 are in the same.)
Step 2:
Disable TXC (transmitter control), the bit 0 of the address of 4 just sets “0”.
NOTE:
Control the AR-B1375/AR-B1376 CPU card’s DTR signal to the RS-485’s TXC communication.
(2) Send out one character (Transmit)
Step 1:
Enable TXC signal, and the bit 0 of the address of 4 just sets “1”.
Step 2:
Send out the data. (Write this character to the 0 of the current COM port address)
Step 3:
Wait for the buffer’s data empty. Check transmitter holding register (THRE, bit 5 of the address of
5), and transmitter shift register (TSRE, bit 6 of the address of 5) are all sets must be
“0”.
Step 4:
Disabled TXC signal, and the bit 0 of the address of 4 sets “0”
(3) Send out one block data (Transmit – the data more than two characters)
Step 1:
Enable TXC signal, and the bit 0 of the address of 4 just sets “1”.
Step 2:
Send out the data. (Write all data to the 0 of the current COM port address)
Step 3:
Wait for the buffer’s data empty. Check transmitter holding register (THRE, bit 5 of the address of
5), and transmitter shift register (TSRE, bit 6 of the address of 5) are all sets must be
“0”.
Step 4:
Disabled TXC signal, and the bit 0 of the address of 4 sets “0”
(4) Receive data
The RS-485’s operation of receiving data is in the same of the RS-232’s.