A
A
R
R
-
-
B
B
1
1
3
3
2
2
0
0
U
U
s
s
e
e
r
r
’
’
s
s
G
G
u
u
i
i
d
d
e
e
5-4
5.4 PROGRAMMING THE RS-485
The majority of the communicative operations of the RS-485 are the same as the RS-232. When
the RS-485 proceeds with the transmission which needs to control the DTR(TXC) signal, the
installation steps are as follows:
Step 1:
Enable DTR (Data Terminal Relay)
Step 2:
Send out data
Step 3:
Wait for data to empty
Step 4:
Disable DTR
NOTE: Please refer to the section of the “Serial Port” in the chapter “System Controller”
for the detailed description of the COM port’ s registers.
(1) Initializing the COM port
Step 1:
Initialize the COM port in the receiver interrupt mode, and /or transmitter interrupt mode. (All
of the communication protocol buses of the RS-485 are the same.)
Step 2:
Disable DTR (Data Terminal Relay) the bit 0 of the address of 4 just sets to “ 0”.
å
NOTE: Control the AR-B1320 CPU card’ s DTR signal to enable/disable the RS-485’ s TXC
communication.
(2) Send out one character (Transmit)
Step 1:
Enable the DTR signal, and the bit 0 of the address of 4 just sets to “ 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 to empty. Check the transmitter holding register (THRE, bit 5 of
the address of 5), and transmitter shift register (TSRE, bit 6 of the address of
5) so that all sets are set to “ 0”.
Step 4:
Disable the DTR signal, and the bit 0 of the address of 4 sets to “ 0”
(3) Send out one block data (Transmit – the data can be more than two characters long)
Step 1:
Enable the DTR signal, and the bit 0 of the address of 4 just sets to “ 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 to empty. Check the transmitter holding register (THRE, bit 5 of
the address of 5), and transmitter shift register (TSRE, bit 6 of the address of
5) so that all sets are set to “ 0”.
Step 4:
Disabled DTR signal, and the bit 0 of the address of 4 sets to “ 0”
Содержание AR-B1320 CPU
Страница 20: ......
Страница 51: ...A AR R B B1 13 32 20 0 U Us se er r s s G Gu ui id de e 4 1...
Страница 52: ......