2 programming rs-485 – Sony DX4 User Manual

Page 66

Advertising
background image

AR-B1474 User¡

¦s Guide

9-2

Example 1:

Select the 10th bank of the MEM1 on the AR-B1474. The AR-B1474 is using 27C020 (256K*8), and
the base port is &H210.

100 base_port=&H210
110 OUT base_port+0,&H59

Example 2:

Select the 40th bank of MEM3 on the AR-B1474. The AR-B1474 is using 27C040 (512K*8), and the
base port is &H390.

200 base_port=&H390
210 OUT base_port+0,&HD7

9.2 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 offset+4 just sets “0”.

NOTE:

Control the AR-B1474 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 offset+4 just sets “1”.

Step 2:

Send out the data. (Write this character to the offset+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
offset+5), and transmitter shift register (TSRE, bit 6 of the address of offset+5) are all sets must be
“0”.

Step 4:

Disabled TXC signal, and the bit 0 of the address of offset+4 sets “0”

Advertising
This manual is related to the following products: