SERIAL PORTS

DESCRIPTION

The RPC -320 has two serial ports that interface to a printer, terminal, RS-485 network, or other serial devices. This chapter describes their char acteristics and how to use th em. Fre quent ref erence s are m ade to commands listed in the BASIC-52 Programm ing Manual or RPBASIC-52 Software Supplement in this manua l. Please refer to these manuals for m ore information about these comm ands.

Serial por ts are num bered C OM 0 and CO M1. COM 0 is RS232 only and is used for progr am deve lopment. During r un time, it can be used for other functions. COM 1 is a general purpose port and is jumperable for RS-232 or RS-422/485.

Each port has a 256 character interr upt driven input and output buffer. This allows sending characters without slowing down program execution. How ever, if the PRIN T buffer fills, pr ogram execution is susp ended until all PRINT char acters are in the buffer. Both ports have a 256 character input buffer. When mor e than 256 characters are r eceived, excess ones are ignored.

CON FIG BAU D controls baud rate and RS-232/485 mode (CO M1 only).

Figure 4-1 Serial port and jumper locations

ON C OM $ is useful whe n data is sent in pac kets. This multitasking command branches to a BASIC subroutine when a sp ecific char acter or number of chara cters is received.

Another useful function is STR. Strings can be formatted, analyzed for length and content. When used in conjunction with ON COM $, networ king over RS-485 is much easier than with the original BASIC-52.

SECTION 4

COM0 SERIAL PORT

This port uses a VTC-9F serial cable to connect external serial dev ices to the por t. T he cable con sists of a 10 pin IDC connector wired one - to - one to a DB- 9 connector .

Line 10 is sim ply cut off. The pin ou t is designed so it plugs directly into the 9 pin serial port connector on a PC .

CTS is a output and is set to high on power up.

Norm ally, this tells the other device to send data. The CTS line is set high or low to hold off communication. The sending device must have a RTS input. L ine 400 sets CTS high and 500 sets it low, or to hold off.

400 LINEB 5,0,(LINEB(5,0) .AND. 247)

500 LINEB 5,0,(LINEB(5,0) .OR. 8)

COM 0 is normally used for program ming. D uring run time it ma y be used as a genera l purpose serial por t. When used for programming or with the INPUT statement, it will accept ASCII character values from 0 to 127 . When used with the GET function, it will return ASCII values from 0 to 255.

COM1 SERIAL PORT

COM 1 is either an RS-232 or RS-422/ 485 port. A VTC -9F serial cable, descr ibed above, is used for RS- 232 level communications. RS-485 is from screw terminals. COM 1 has 2 hardw are handshaking lines, CTS and RT S.

RTS is an input to the car d. W hen RT S to the car d is low, it usually indicates the sender does not want any data sent to it. The status of this port is read by the LINEB statement. The example below retur ns a status of the RTS line:

100 B = LINEB(5,1) .AND. 32

If B = 32, the sender is not requesting information and nothing further should be printed.

The CT S line may be set high or low to hold off

comm unication from a se nding device. The sender must recognize the CTS line. Line 400 sets CTS high and 500 sets it low, or to hold off.

Page 4-1 RPC -320

Page 15
Image 15
Remote Technologies RPC-320 manual Serial Ports, COM0 Serial Port, COM1 Serial Port