Accessing com0 and com1, Disabling control-c, Commands – Remote Processing RPC-330 User Manual
Page 17: Serial port pin out

SERIAL PORTS
SECTION 4
Page 4-4 RPC -330
Access CO M0 and C OM1 buffers in one of thre e ways:
1.
INP UT sta tement. This re moves a ll charac ters in
the buffer up to the term inator cha racter and puts
them into a variable.
When using the INPUT statement, program
execution is susp ended until a < cr> (Enter key) is
received. W hether this is a problem depends on
your particular application.
INPUT strips bit 7. This means ASCII characters
from 0 to 127 are rec eived.
2.
GET function. Char acters ar e rem oved one at a
time as an ASCII value. A 0 is returned when the
buffer is e mpty. Use the C OM function to
determine if the buffer is empty or if a 0 is an
ASCII value.
If you don' t read the b uffer an d the buffer fills, all
subsequent characters are discarded. GET m ay be
u s ed a ny w h er e in th e pr o g ra m .
3.
COM$(n) retrieves all characters in the buffer,
including other control codes (except CR).
ACCESSING COM0 AND COM1
The port INP UT and GE T functions retrieve data using
the UIn c omm and. UI0 r outes inputs to C OM 0 while
UI1 routes inputs to the COM1 port. PRINT outputs are
set by the U On com mand. UO0 p rints out C OM 0 while
UO1 outputs COM1. PRINT #1, is an alternative way
to print to COM 1.
The following show how UIn and U On work.
100 UI0
Set to COM0
110 INPUT A
Get data from COM0 port
520 UI1
Switch to COM1 port
530 INPUT B
Get data from COM1 port
800 R E M Pr in t t o C O M 0
810 P R I NT " T e m pe r at ur e : " , T
900 R E M Pr in t t o C O M 1
910 P R I N T #1 , " S e t p r e ss u re a t: " , C A
Power up default is set to COM 0.
DISABLING CONTROL-C
Program execution is terminated by entering a
< Cntl> < C> . To disable < Cntl> < C> so program
execution is not terminated, execute the following
statemen t:
DBY(38) = DBY(38) .OR. 1
COMMANDS
The following is a list of RPBASIC-52 commands used
for serial I/O. These commands and functions are
explained in the BASIC-52 Programm ing Manual and
RPBASIC-52 Software Supplement in this manua l.
Comm and
Function
C L E AR C O M $
Clears serial input buffer
C O M $
Returns string from buffer
COM
Returns number of characters
in buffer
C O N F I G BA U D
Sets serial port parameters
GET
Returns a character fr om the
serial buffer
I N P U T
Receives string from port
LIST
Outputs program listing
O N C OM $
Branches to a subroutine when
specified parameters are met
P R I N T
Outputs data in various
form ats
PRINT #,
Prints to a specified port
SPC
Print out n number of spaces
STR
Various string comma nds.
Useful for networking and
output formatting.
TAB
Tabs to predetermined
positions
UI0
Reroute inputs to COM0
UI1
Route inputs to COM1
UO0
Rerou te PRIN T statem ent to
C O M 0
UO1
Route P RINT statement to
C O M 1
U S I N G
PRINT formatting statement
SERIAL PORT PIN OUT
Pin outs for J1 and J2 are shown below. Unused pins
are open.
J1 &
N a m e
Direction