ProSoft Technology MVI56-BAS User Manual
Page 74

Using ASCII Communications
MVI56-BAS ♦ ControlLogix Platform
User Manual
BASIC Module (DB/BAS Compatible)
Page 74 of 234
ProSoft Technology, Inc.
December 13, 2011
6.1
Port Transmit and Receive Buffers
MVI56-BAS PRT1 and PRT2 have an internal transmit and receive buffer. Each
buffer has a capacity for 1024 bytes.
The PRINT command sends characters to the two serial ports. PRINT sends
characters to the program port, PRINT@ also sends characters to PRT1, and
PRINT# sends characters to PRT2. The MVI56-BAS transmits one character at a
time until the buffer is empty. If software handshaking (XON/XOFF) has been
selected, and an XOFF character has been received, then the port will not
transmit until an XON has been received. If hardware handshaking has been
selected, and the CTS signal is OFF, then the port will not transmit until CTS
transitions ON. In either case, the transmit buffer will accumulate characters until
it is full.
In order to avoid a situation where the BASIC program tries to write characters to
a transmit buffer that is already full, the following CALLs can be used to verify the
current number of characters in PRT1 and PRT2:
CALL 36 = Get Number of Characters in PRT2 transmit buffer
CALL 95 = Get Number of Characters in PRT1 transmit buffer
If necessary, the BASIC program can clear the current transmit and receive
buffers using the following CALLs:
CALL 37 = Clear PRT2 Transmit and Receive Buffers
CALL 96 = Clear PRT1 Transmit and Receive Buffers
The same idea applies when an ASCII device writes data to MVI56-BAS PRT1 or
PRT2: it will be stored in the receive buffer until is read by a INPUT statement
(INPUT@ = PRT1 or INPUT# = PRT2)