SERIAL PORTS
DESCRIPTION
The RPC
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
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
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
SECTION 4
COM0 SERIAL PORT
This port uses a
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
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