Remote Technologies RPC-320 Accessing COM0 and COM1, Disabling CONTROL-C, Serial Port PIN OUT

Page 18

SERIAL PORTS

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 ASCII value . Use UIn 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 UI0Set to COM0

110 INPUT A Get data from COM0 port

520 UI1Switch to COM1 port

530 INPUT B Get data from COM1 port

800

REM

P r in t t o C O M 0

810

PRINT "Temperature:",T

900 REM Print to COM 1

910PRINT#1, "Set pressure at:",CA

Power up default is set to COM 0.

SECTION 4

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

CONFIG BAUD

Sets serial port parameters

GET

Returns a character fr om the

 

serial buffer

INPUT

Receives string from port

LIST

Outputs program listing

PRINT

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

USING

PRINT formatting statement

SERIAL PORT PIN OUT

Pin outs for J1 and J2 are shown below. Unused pins are open.

J1 &

Name

Direction

J2

 

from card

3

Tx

Out

4

RTS*

In

Page 4-4 RPC -320

Image 18
Contents REV TrademarksRevision Table of Contents Interrupt Characteristics Sect ION 11 Watchdog Timer DescriptionExternal Reset Sect ION 13 Multi Mode Counter DescriptionSoftware Revision History Description OverviewSection Manual OrganizationSymbols and Term inology Technical SupportOverview Section System layoutOperating Precautions IntroductionEquipment First Time Operation Using a PCUsing a Terminal Uploading and Downloading ProgramsEditing programs and program ming hints Where to GO from Here TroubleshootingEprom Saving ProgramsSaving a Program W3 autorun jumperLoading a Program AutorunningPreventing Autorun Changing Eprom SizeBload CommandsAlternate Eproms BsaveSerial Ports COM0 Serial PortCOM1 Serial Port Serial Ports Section RS-422/485 Operating InformationRS-422/485 Termination network Accessing Serial Buffers Two wire RS-485Multidrop Network Accessing COM0 and COM1 Disabling CONTROL-CSerial Port PIN OUT RXD CTS RAM Memory Battery BackupChecking the battery Changing MemoryReserved Memory Storing Variables in RAMAssembly Language Interface Block Data TransferDigital and Opto Ports Digital I/O PortsDigital Por t J3 High Current Port L8 Digital I/O CommandsDigital Port P6 Optically Isolated InputHigh Current Output Interfacing to switches and other devices Interfacing Digital I/O to an opto-module rackDigital I/ O prog ramm ing exam ple Ls e Width Modulation PWM Digital and Opto Ports Section Conne ctor pin ou t J3Line Config LineCount Line BSetting Date and Time DateM E Section Connecting Displays Writing to the DisplayProgramming Example Display Connector PIN OUT Display TypesKeypad Port Program explanationKeypad Port PIN OUT J5 Initialization Connecting Analog InputsAnalog Input Overvoltage conditionsDifferential Mode Examples u sing CON FIG AINAcquiring Analog Data Temperature Measurement Noise NotesAnalog Input Section Data logging on a timer tick Measuring Higher VoltagesConverting Analog Measurements AmplifiersMeasuring 4-20 mA current loops Calibration Watchdog Timer External ResetInterrupt Characteristics Optically Isolated InterruptProgram Example Optically isolated and TTL interrup ts Load ProgrammingGND GateCOU NT0 Power Management Further Power ReductionPower Management Section Program Examp leElectrical Specifications Technical InformationJumper Descriptions Mechanical SpecificationsMemory and I/O Bank MAP Bank