Accessing com0 and com1, Disabling control-c, Commands – Remote Technologies RPC-320 User Manual

Page 18: Serial port pin out

Advertising
background image

SERIAL PORTS

SECTION 4

Page 4-4 RPC -320

You can access C OM0 and COM 1 buffers in three w ays:

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
A S C II v al ue . U s e U In to select the serial port for
G E T.

If you don' t read the b uffer an d the buffer fills, all
subsequent characters are discarded.

3.

COM$(n) retrieves all characters in the buffer,
including other control codes (except CR).

ACCESSING COM0 AND COM1

INPU T and GET functions retrieve data using the UIn
comm and. UI0 r outes inputs to C OM 0 while U I1 inputs
from the CO M1 port. PRINT outputs are set by the
UOn command. UO0 prints out COM0 while UO1
outputs COM1 using the PRIN T comm and. PR INT #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 REM

P r in t t o C O M 0

810 P R I NT " T e m pe r at ur e : " , T

900 REM Print to COM 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

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

String handling commands

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

J2

from card

3

Tx

Out

4

RTS*

In

Advertising