Remote Technologies Universal Remote RPC 320 User Guide

RPC-320 USER'S MANUAL  
REV 2  
NOTICE TO USER  
Copyright 1997, 1999 - Remote Processing C orporation.  
All rights reserved. However, any part of this document  
may be reproduc ed with Remote Proce ssing cited as the  
source.  
The information contained in this manual is believed  
correct. However, Remote Pr ocessing assumes no  
responsibility for any of the circuits described herein,  
conveys no license under any patent or other right, and  
make no repre sentations that the circuits are free from  
patent infringement. Rem ote Processing makes no  
representation or warr anty that such applications will be  
suitable for the use specified without further testing or  
modification. The user must make the final  
The con tents of this manual and the specifications her ein  
may change without notice.  
TRADEMARKS  
RPBASIC-52™ is a trademark of Remote P rocessing  
Corpor ation.  
determination as to fitness for a particular use.  
Remote Pr ocessing Corporation' s general policy does not  
recommend the use of its products in life support  
applications where the failure or malfunction of a  
component m ay directly threaten life or injury. It is a  
Condition of Sale that the user of Remote Processing  
products in life support applications assum es all the risk  
of such use and indemn ifies Remote Pr ocessing against  
all damages.  
PC SmartLIN is a trademark of Octagon Systems  
Corpor ation.  
BASIC-52© is a trademark of Intel Corpor ation.  
Remote Processing Corporation  
79 75 E. Harvard Ave.  
Denver, Co 802 31 USA  
Tel: (303) 690 - 1588  
Fax: (303) 690 - 1875  
w w w .rp3.com  
P/N 1366  
Revision: 2.8  
Page i RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
TABLE OF CONTENTS  
SECT ION 11  
WATCHDOG TIMER  
DESCRIPTION . . . . . . . . . . . . . . . . . . . 11-1  
EXTERNAL RESET . . . . . . . . . . . . . . . . 11-1  
DESCRIPTION . . . . . . . . . . . . . . . . . . . 11-1  
OPTICALLY ISOLATED INTERRUPT . . . 11-1  
INTERRUPT CHARACTERISTICS . . . . . . 11-1  
SECT ION 12  
EXTERNAL INTERRUPT  
DESCRIPTION . . . . . . . . . . . . . . . . . . . 12-1  
PROGRAMMING . . . . . . . . . . . . . . . . . 12-1  
Program exam ples . . . . . . . . . . . . . . 12-1  
COMMANDS . . . . . . . . . . . . . . . . . . . . 12-2  
SECT ION 13  
MULTI-MODE COUNTER  
DESCRIPTION . . . . . . . . . . . . . . . . . . . 13-1  
SECT ION 14  
POWER REDUCTION  
FURTHER POWER REDUCTION . . . . . . 14-1  
Prog ram Exam ple . . . . . . . . . . . . . . . 14-2  
SECT ION 15  
TECHNICAL INFORMATION  
ELECTRICAL SPECIFICATIONS . . . . . . 15-1  
MEMORY AND I/O BANK MAP . . . . . . . 15-2  
MECHANICAL SPECIFICATIONS . . . . . 15-2  
JUMPER DESCRIPTIONS . . . . . . . . . . . 15-2  
Page iii RPC-320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
SOFTWARE REVISION HISTORY  
V1.04  
V1.05  
Release for RPC 320  
BSAVE retur ned a hardware er ror when ver ify  
was bad. In fact, save was OK.  
V1.06  
V1.07  
V1.08  
LCD graphics hardware CS and reset are  
reversed. C ompensated in software.  
MTO P was useless in any system, especially a  
32K RAM.  
Varia bles E and F would get dropped if  
followed by a space.  
Added de lays betwee n data strob e writes to  
LCD display.  
V1.09  
V1.10  
STR(7, . . .) did not put in a CR into the put  
string, causing longer strings to be printed.  
Initial release for RPC-330.  
Added AOT command (330 only)  
Added COUNT, ON COM , ON COUNT, ON  
LINE, and ON KEYPAD  
V1.11  
11/29/95  
Added day of week to DAT E comm and and  
function.  
V1.12  
V1.13  
12/01/95  
Added code to use Atmel 29C040A flash.  
01/12/96  
Added code to support IEE centry series  
display (3602-100-05420)  
Includes PRINT #port  
V1.14  
V1.15  
V1.16  
03/28/96  
Fixed bug in ON C OUN T. Returns error for  
lines > 100.  
06/26/96  
PEEK$ could cause BASIC to lock up under  
right conditions.  
02/18/97  
ON LIN E OF F could cause program to lock up  
if running ON COM.  
Syntax error when DISPLAY used with IF-  
THEN-ELSE.  
Added PE EKF a nd POKE F com mands.  
Page iv RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
OVERVIEW  
SECTION 1  
from your PC are downloaded using a serial  
communication program.  
DESCRIPTION  
The RP C-320 is an embed ded contr oller with a built in  
Basic language. Several featur es make it suitable as a  
stand alone unit:  
MANUAL ORGANIZATION  
This manual pro vides all the infor mation r equired to  
install, c onfigure , and operate the RPC-320. Using this  
manual you will be able to:  
Built in RPBASIC-52 programm ing language  
supports hardware using single commands. On card  
flash EPROM programm er can save up to 8  
progr ams to 62K , or about 500K tota l.  
Interface the RPC-320 to your IBM compatible PC  
or terminal.  
High speed multimode counter accepts quadrature or  
single inputs. Program mable for up/dow n, binary,  
divide-by-N, X1, X2 or X4 quadr ature counting.  
Understand the operation of the RPC-320 hardware  
using RPBASIC-52 programming software.  
This manual assumes you are fam iliar with some type of  
BASIC progr amming software. The syntax used by  
RPBASIC-52 is similar to BASIC-52. If you are not  
experie nced with a ny BASIC softwar e, you may w ant to  
refer to books and training program s available through  
your local book store. The BASIC-52 Programm ing  
Manual has information and examples for the original  
commands. Comm ands unique or modified by  
RPBA SIC-52 a re in the Sof tware Supplement in this  
manual.  
LCD character and gr aphic display and keypad p orts  
for operator interface.  
Two R S-232 ser ial ports, one of whic h is  
configurable for RS-422/485.  
Watchdog timer resets card if a program "crashes".  
34 digital I/O lines, 9 of which are high curre nt  
outputs. 24 of these lines can connect to an opto  
rack or o ther TT L devices.  
Each chapter or section is written to first provide an  
overview. Then, m ore specific information is provided.  
Each chapter has some examples using Basic. A  
summar y of related hardware com mands is at the end of  
most chapters.  
Eight channel, 12 bit resolution analog to digital  
converter. Configurable operational amplifiers  
allow you to signal condition inputs or measure  
temperature.  
32K, 128K, or 512K RAM battery backable to save  
process variables and other data when power is off.  
MANUAL CONVENTIONS  
Information appearing on your screen is shown in a  
different type.  
32K or 512K flash EPRO M to save program s and  
data.  
Example:  
The RPC -320 uses an 80C320 CPU operating at 22.1184  
Mhz. It can operate stand alone or on a network using  
the RS-485 port. Its 4. 7" x 7. 0" size with 4 mounting  
holes makes it easy to mount in a NEMA box.  
Compactness is enhanced by on-board analog and digital  
terminal strips.  
RPBASIC-52 V1.0  
Copyright Intel (1985) and Remote Processing  
Bytes free: 27434  
RPBA SIC-52 p rogr amm ing language is standard. T his  
language is a version of the original Intel BASIC-52. It  
was m odified for the RPC -320 for c ontrol, data  
acquisition applications, and on board har dware fea tures.  
Program development can take place on your PC, using  
your word processor, or on the RPC-320. Programs  
Page 1-1 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
OVERVIEW  
SECTION 1  
TECHNICAL SUPPORT  
Symbols and Term inology  
If you have a question about the RPC-320 or RPBASIC-  
52 and can' t find it in this manual, call us and ask for  
technical supp ort. Technical support hours ar e 9 AM to  
4 PM mountain time.  
NOTE: Text under this heading is helpful information.  
It is intended to act as a reminder of some  
operation or interaction with another device that  
may not be obvious.  
When you call, please have your R PC-320 and BASIC-  
52 PROGRAMMING MANUAL ready. Many times it is  
helpful to know what the R PC-320 is used for, so please  
be ready to describe its application as well as the  
problem.  
WARNING:  
Information under this heading warns you of  
situations which might cause catastrophic or  
irreversible damage.  
Phone: 303-690-1588  
FAX: 303-690-1875  
W[-]  
Denotes jump er block pins.  
< xxx> Paired angle brackets are used to indicate a  
specific key on your ke yboard. F or exam ple  
< esc> means the escape key.  
The RPC -320 uses a Dallas Semiconductor DS80C320  
processor. Additional information can be obtained from  
Dallas Semiconductor (214-450-0448, F AX 214-450  
0470), or your distributor.  
BASIC uses the decimal convention for designating  
addresses and data. There are times when hexadecimal  
notation is mo re convenient to use. Notation use d in this  
manual and BASIC-52 is the ' H' character after the  
number. 8CH stands for 8 C hexadecimal.  
Page 1-2 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
OVERVIEW  
SECTION 1  
Figure 1-1 System layout  
Page 1-3 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
SETUP AND OPERATION  
SECTION 2  
can easily arc through cables and to the card.  
Simply touching your PC before you touch the  
card can greatly reduce the amount of static.  
INTRODUCTION  
The RPC -320 is ready to program as soon as you  
connect it to a ter minal or PC a nd apply pow er. This  
chapter describes what is needed to get a sign- on  
message and begin program ming.  
2. Do not insert or remove components when  
power is applied. While the ca rd is a + 5 volt  
only system, other voltages generated on the  
card which affect other com ponents.  
Requirements for uploading and downloading programs  
are discu ssed. A "W here to go from here" section tells  
you what chapters to refer to in order to use the various  
capabilities of the RPC-320. Finally, a troubleshooting  
section helps out on the most com mon pro blems.  
EQUIPMENT  
You will need the following equipment to begin using the  
RPC-320:  
OPERATING PRECAUTIONS  
RPC-320 embedded controller  
PC w ith a serial port and com munications  
program  
or a  
Terminal  
The RPC -320 is designed to handle a wide variety of  
temperature ranges at low power. These characteristics  
requir e using CM OS com ponents. CM OS is static  
sensitive. T o avoid damaging these c omponents,  
observe the following precautions before handling the  
RPC-320.  
VTC -9F ser ial cable  
+ 5, 200 ma po wer supply  
Refer to Chapter 4, SERIAL PORTS, for w iring  
information to make your own serial cable.  
1. Ground yourself before handling the RPC -320  
or plugging in cables. Static electricity  
Figure 2-1 Connector location and function  
Page 2-1 RPC-320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
SETUP AND OPERATION  
SECTION 2  
Turn on your pow er supply. On pow er up a  
copyright message is printed.  
FIRST TIME OPERATION  
Become familiar with the locations of connectors before  
getting started. See Figure 2-1.  
RPBASIC-52 V1.09  
RPC-320  
RPC -320 jump ers have been set at the fa ctory to operate  
the system immediately. F or first time operation, do not  
install any connectors or parts unless specified below.  
Jumpers sho uld be kept in default positions.  
Copyright Remote Processing (1994)  
Bytes free: 63740  
65,536 bytes of additional expanded memory detected  
512K byte EPROM installed  
1. Connect power.  
If a nonsense message appears, your terminal or PC  
may not be set to the appropriate communication  
parameters. If the system still does not respond,  
refer to TROUBLESHOOTING later in this chapter.  
The RPC-320 needs + 5 ±0.25 volts at 100 ma.  
Any well regulated supply that supp lies this will  
work. Be careful when using "switching" power  
supplies. Some of the se supplies do no t regulate  
properly unless they are adequately loaded. Don' t  
forget that power requir ements inc rease w hen opto  
modules a re used. G4 opto m odules require up to  
20 ma each.  
The sign on message may differ based on the RAM  
and flash EPROM installed.  
4. Testing.  
The system is now in the " imme diate mode" and is  
ready for you to start program ming. T ype the  
following program:  
Make sure pow er is off. Connec t the power supply  
to one of the appropriately marked terminals on the  
RPC-320. There two power connectors: P2 and P 6.  
Either one may be used to connect power.  
10 FOR X=0 TO 2  
20 PRINT "Hello ",  
30 NEXT  
2. Hook up to a PC or terminal.  
40 PRINT  
You can use either a PC o r CR T term inal to  
program the RPC-320. Connect one end of the  
VTC -9F connector to the 10 pin COM 0 port on the  
RPC-320. Refer to Figure 2-1 for connector  
location.  
Now type RUN. The system will display:  
Hello Hello Hello  
READY  
>
Terminate a program by typing a < Ctrl> -C.  
Using a PC  
Connect the VTC-9F serial cable to the PC's COM1  
or COM 2 port. Y ou may need a 9 pin male to 25  
pin female adapter . T he VT C-9F is designed to  
plug directly into the 9 pin serial port connector on a  
PC.  
UPLOADING AND DOWNLOADING  
PROGRAMS  
Downloading program s means transferring them fr om  
your PC (or terminal) to the RPC-320. Uploading  
means transferring them from the RPC -320 back to the  
PC. This section explains how to do both of these  
procedures using generalized instructions for terminal  
programs (Procomm , Windows Ter minal, etc.)  
Start up your serial communication program. Set  
comm unication par ameter s to 9600 baud, 8 da ta  
bits, no parity, 1 stop.  
Using a Terminal  
When uploading or downloading files, select ASCII text  
format. XMODEM, YMODEM, or other formats are  
not used.  
Follow your term inal instructions to set the baud  
rate to 9600 baud, 8 data bits, no parity, and 1 stop.  
You may need a 9 pin male to 25 pin male adapter  
to connect the VTC-9F.  
RPBASIC-52 does not know w hen you are typing in a  
progr am or if something else (laptop or mainfr ame) is  
3. Power up.  
Page 2-2 RPC-320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
SETUP AND OPERATION  
SECTION 2  
increased download time.  
sending it char acters. The uploa d and dow nload file  
does not contain any special codes; they are sim ply  
ASCII cha racters.  
Notice that you can w rite a progr am in lower case  
characters. RPBASIC-52 translates them to upper case.  
Uploading programs is simply a process of receiving an  
ASCII file. Y ou or your progr am simply need to send  
"LIST " to receive the entire program . The default baud  
rate (960 0) is rather high. The RP C-320' s baud ra te is  
changed using the CONF IG BAUD command.  
Some program mers put "N EW" as the first line in the  
file. During debugging, it is common to insert  
"temporary" lines. This ensures that these lines are  
gone. Down loading time is increase d when the old  
progr am is still pre sent. If you like to wr ite progr ams in  
separate modules, you can dow nload them separately.  
Modules are assigned blocks of line numbers. Star t up  
code might be from 1 to 999. Interrupt handling  
(keypad, serial ports) might be from lines 1000 to 1499.  
Display output might be from 1500 to 2500. The  
programmer must determine the number of lines  
required for each section.  
Downloading a program requires transmitting an ASCII  
file. As you type in (or download) a line, RP BASIC-52  
tokenizes, or com piles, that line. The time to do this  
depends upon its complexity and how many lines of code  
have been entered.  
RPBASIC-52 m ust finish compiling a line before starting  
the next one. When a line is compiled, a "> " character  
is sent. This should be your terminal progra ms pacing  
character for dow nloading.  
RPBASIC-52 autom atically formats a line for minimum  
code space. F or example, you could download the  
following line of code:  
If your communications program cannot look for a  
pacing prompt, set it to delay transmission after each line  
is sent. A 100 ms delay is usually adequate, but your  
program may be long and complex and require more  
time. A r esult of a short transmission time is missing or  
incomplete pro gram lines.  
10 fora= 0to5  
When you listed this line, it would appear as:  
10 FOR A=0 TO 5  
Spaces are displayed but not stored. The following line:  
Editing programs and program ming hints  
10 for a  
=
0
to  
5
Files uploaded or downloaded are simply ASCII DOS  
text files. No special characters or control codes are  
used. You m ay create and edit programs using your  
favorite word processor or editor. Just be sure to save  
files in DO S text form at.  
would be compressed and displayed as in the second  
example above. Spaces are removed. H owever, spaces  
as part of a remark or PRINT are not removed.  
Instead of uploading and downloading programs, you can  
save them to the on card EPRO M. This is useful if you  
are using a terminal to write program s. Simply type  
SAVE. To retrieve a program, type LOAD.  
A technique used to further program documentation and  
reduce code space is the use of comments in a  
downloaded file. For example, you could have the  
following in a file written on your editor:  
REM Check position  
REM Read output from the pot and  
REM calculate the position  
2200 a = ain(0) :REM Get position  
The first 3 comments downloaded to the RPC -320  
are ignored. Similarly, the empty lines between  
comm ents are a lso ignored . L ine 2200, with its  
comment, is a part of the program and could be listed.  
The m ajor pena lty by writing a progr am this w ay is  
Page 2-3 RPC-320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
SETUP AND OPERATION  
SECTION 2  
attached, you should see a burst of activity. With a  
volt meter, you should see a change in voltage.  
Using a Fluke 8060A set to measure A C, you  
should see a mom entary rea ding above 2 volts.  
WHERE TO GO FROM HERE  
If you want to do this:  
Turn to  
Chapter  
3. Install the serial cable and make sure the voltages  
and output activity are still there. Output is from  
pin 3 on the VTC-9F. If not, check to make sure  
something is not shorting the output.  
Save a program  
Run a program at power up or  
reset (autorun)  
3
3
4
5
5
5
6
6
6
6
7
8
9
10  
12  
13  
14  
Know m ore about serial por ts  
Install a differ ent RAM mem ory chip  
Using RAM to save variables  
Run an assembly language program  
Configure digital I/O lines  
Detect on/off switch status  
Use high c urre nt outputs  
Connect an external opto rack  
Calendar/ clock option  
Connect Displays  
4. Check the serial pa ram eters on your P C or termin al.  
They should be set to:  
9600 baud, no parity, 8 data bits, 1 stop  
5. If you are receiving a sign on me ssage but not ab le  
to enter characters, check U8, pin 4 for at least -6  
volts. When it is near 0 volts, the terminal or PC's  
Tx line is not connected. When you pr ess a  
character on the terminal or P C, you should see the  
voltage go positive. Check the serial cable.  
Use a keypad  
Measure voltages  
Using inter rupts  
Multi-mode counter  
Transmitted signals from the PC or terminal are  
from pin 5 on the 10 pin IDC connector.  
Use low power operation  
If all of this fails, call technical support listed in chapter  
1.  
Refer to the table of contents for a more detailed listing.  
TROUBLESHOOTING  
You would probably turn to this section because you  
could not get the sign on message. If you are getting a  
sign on message but can' t enter characters, then read  
section 5 below . T he following are troubleshooting hints  
when you can' t get anything.  
1. Check the power source. If it is below 4.65 volts at  
the input pow er ter minal, the RPC -320 will r eset.  
Power is 5 ±0.25 volts. Make sure it is a clean 5  
volt source . If it dips intermittently to 4. 65 volts  
(due to switching noise or ripple), the card will reset  
for about 100 ms. If the noise is frequent enough,  
the card will be in per manent reset. Check U7, pin  
8. If it is high (about 5 volts), then the car d is in  
reset. T his line should be low (about 0 volts).  
2. Check the COM 0 port (J3). Rem ove the connector  
from COM 0. R efer to the outline drawing ear lier in  
this chapter. Connect an oscilloscope (preferred) or  
a voltmeter to pin 3 (T xd) and gr ound. Pin 3 should  
be -6 volts or more negative. (Pin 1 is designated  
by the v symbol on the connector. Pin 3 is next to  
it, nearer the key opening.) If you have -6 volts or  
more, press the reset switch. If you have a scope  
Page 2-4 RPC-320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
SAVING PROGRAMS  
SECTION 3  
A flash EPROM is non-volatile (retaining data even  
INTRODUCTION  
when power is disconnected), having an unlimited  
number of re ad cycles and a limited number of write  
cycles (about 1,000). A program is not run fr om  
EPROM . It is transferred to RAM and run from there.  
Prog ram s in RAM can be m odified. They ar e saved to  
EPROM for execution later.  
Program s are stored in an EPRO M in socket U6. You  
can store one or mor e program s, depending upon  
EPROM size. A BASIC program can call another when  
a 512K byte EPROM is used.  
Maximum program size that can be run at any one time  
is about 62K, not including space for variables. 32K  
bytes is the maximum program size when a 29C256 IC  
type is used to save a program.  
The RPC -320 can autorun on power up or r eset by  
removing jumper (W9). W hen autorun is on, the  
program in EPROM segment 0 is loaded into RAM and  
begins to execute immediately.  
A conservative rule to determine program memory  
requirements is one line requires 40 bytes. 32K bytes  
would stor e 800 lines of code. Your application cou ld  
be significantly more or less, depending upon the  
number of comm ands/line, com ments, and pr int  
statements.  
Despite the fact you may have a 128K or 512K RAM  
installed, the maximum progr am size RPBASIC-52 can  
run at one time is about 60K (including room for some  
variable storage). T he table below shows the maximum  
capacity, maximum number of program lines, program  
size at one time, and number of program s for an  
EPROM type.  
Figure 3-1 W3 autorun jumper  
EPROM  
type  
Max  
Cap.  
Prog  
lines  
Max  
Bytes Progs  
No.  
This chapter discusses saving programs to EPR OM (U 6)  
and program autoexecution.  
29C256  
29C040  
30K  
509K 12400  
400  
32K  
62K  
1
8
SAVING A PROGRAM  
For this example, assume you wanted to save the  
following program:  
One program can call another using the EXECUTE n  
command. n is from 0 to 7, depending upon the  
EPROM type.  
20 FOR N= 0 TO 2  
30 PRINT "Hello ",  
40 NEXT  
NOTE: When a program calls another, the old program  
is completely replaced. All variables and  
arrays are clear ed (set to 0).  
50 PRINT  
If this progr am is not alr eady in, type it in now (or , if  
you prefer, use your own progr am).  
To keep variables, you m ust save them before calling the  
new progr am. When the new program is running, these  
variables are restored. Use PEEK and P OKE to read  
and save numbers and strings. See Chapter 5, STORING  
VARIABLES IN RAM for more inform ation.  
Type in the following command:  
SAVE  
Binary data is saved and read from the EPR OM using  
BSAVE a nd BLOA D com mands. The EP ROM has a  
limited number of write cycles (about 1000), so wr iting  
information should be kept to a minimum.  
RPBASIC-52 r esponds with:  
Saving 35 bytes  
Verifying --- OK  
Page 3-1 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
SAVING PROGRAMS  
SECTION 3  
The time it takes save a program depends upon the  
length and complexity of the program and flash EPROM  
type. Pr ogramm ing rate is roughly 600 bytes/second. If  
the program is not successfully saved to EPROM, an  
error message will appear.  
AUTORUNNING  
To autorun a program:  
1. Make sure there is a program in EP ROM (from  
above). When using a 128K or 512K size EPROM,  
make sure the star t up progr am was saved to  
segment 0.  
Saving a pr ogram overw rites the pr evious one. Ther e is  
no way to recover the old one since both occupy the  
same space.  
2. Remove jumper W9.  
Using SAVE without any parameters is the same as  
typing SAVE 0.  
Push the reset button. The program will run. If there  
are any error s, the progr am will stop (assuming you  
have not trapped them with ON E RROR) and display the  
error m essage. EX ECU TE n is used within any  
program to load and run another program. The EPROM  
size must be a 128K or 512K.  
When a 128K (29C 010) or 512K (29C 040) EP ROM is  
installed in U6, the SAVE segment parameter is 0 or 1  
(128K) or 0 - 7 (512K). EX ECU TE loads and runs the  
program in the segment specified by SAVE. A 32K  
(29C256) EPROM can run just one program.  
PREVENTING AUTORUN  
Make the following modifications to the above program  
as instructed to see how one program can call another.  
There m ust be a 128K or 512K EPRO M installed to run  
this code.  
When troubleshooting a program , it' s not always  
convenient fo r an autoe xecute file to r un. This is  
especially tr ue if the pro gram has been configured to  
ignore the < ESC> or < Ctl-C> keys.  
Add the following lines:  
To prevent autorun, install jumper W9 before power up  
or re set.  
10 PRINT "Program segment 0"  
60 EXECUTE 1  
LOADING A PROGRAM  
Now type:  
SAVE 0  
Ther e are tim es when you may w ish to tempor arily  
modify or otherwise test out a change to a program.  
Since the program is loaded into RAM in autorun,  
modifications are m ade withou t affecting the pr ogram in  
EPROM. Use the LOAD or LOAD n comm and to  
transfer the EPROM program to RAM.  
Now m odify lines 10 and 60 as follows:  
10 PRINT "Pr ogram segme nt 1"  
60 EXECUTE 0  
Now type:  
If you find out that modification s are not de sirable or did  
not work, you can restore the original program to RAM  
using the LOAD com mand.  
SAVE 1  
To see the programs operate, type RUN. To stop program  
execution, press < Ctrl-C> .  
CHANGING EPROM SIZE  
The RP C-320 can com e with a 32K or 512 K flash  
EPROM . The size may be changed at any time. Set  
W3 according to the type/size.  
You may notice there is a slight pause between the  
printed he llo' s and program segment number . T his is  
the time it takes to clear memory and load the program.  
Loading and clear ing take appr oximately 0.25 seconds in  
a very small program up to 1 second in a very large  
program.  
Type  
Size  
W3  
Bytes  
Configuration  
29C256 32K  
[3-5], [4-6]  
29C010 128K  
[3-5], [2-4]  
Page 3-2 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
SAVING PROGRAMS  
SECTION 3  
29C040 512K  
[1-3], [2-4]  
COMMANDS  
To change the EPRO M in U6, remove the IC and  
replace it with the new one. Whe n installing a 29C256,  
pin 1 on the IC goes into socket pin 3. The top two  
rows of pins are empty.  
The following is a list of RPBASIC-52 commands used  
for saving, loading, and executing programs and data.  
These comm ands and functions are explained in the  
Software Supplement in this manua l.  
ALTERNATE EPROMS  
Comm and  
BLOAD  
Function  
Flash EPR OMs ar e more expensive than UV er asable or  
OTPs as of this writing. Large volume OEM' s may  
wish to use lower cost EPRO Ms.  
Transfers binary data from  
EPROM to RAM  
Transfers binary data from RAM  
to flash EPROM  
BSAVE  
Program development must use flash EPROM s. Whe n a  
program is finished, the flash EP ROM is used as a  
master. Use an exter nal progra m to duplicate progr ams.  
EXECUTE  
Loads, clear s memory, then runs  
a program from w ithin a program  
Loads a program from EPROM  
Saves a program to flash EPROM  
LOAD n  
SAVE n  
Jumper W2 is normally configured for flash EPROM  
(W2[3-5 ] and W2 [4-6]). For non-flash E PRO Ms, W2 is  
configured for [1-3] and [2-4]. Large volume OEM's  
should contact Remote Processing regarding pre-  
configuring W2 and W3 for your application.  
Page 3-3 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
SERIAL PORTS  
SECTION 4  
COM0 SERIAL PORT  
DESCRIPTION  
This port uses a VTC-9F serial cable to connect external  
serial devices to the por t. T he cable con sists of a 10 pin  
IDC connector wired one-to-one to a DB-9 connector.  
Line 10 is sim ply cut off. The pin out is designed so it  
plugs directly into the 9 pin serial port connector on a  
PC.  
The RPC -320 has two serial ports that interface to a  
printer, terminal, RS-485 network, or other serial  
devices. This chapter describes their char acteristics and  
how to use them. Fre quent ref erence s are m ade to  
commands listed in the BASIC-52 Programm ing Manual  
or RPBASIC-52 Software Supplement in this manua l.  
Please refer to these manuals for m ore information about  
these comm ands.  
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.  
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  
RS-232 or RS-422/485.  
400 LINEB 5,0,(LINEB(5,0) .AND. 247)  
500 LINEB 5,0,(LINEB(5,0) .OR. 8)  
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.  
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  
CON FIG BAU D controls baud rate and RS-232/485  
mode (CO M1 only).  
COM 1 is either an RS-232 or RS-422/ 485 port.  
A
VTC -9F serial cable, descr ibed above, is used for RS-  
232 level communications. RS-485 is from screw  
terminals. COM 1 has 2 hardw are handshaking lines,  
CTS and RT S.  
RTS is an input to the car d. W hen RT S to the card 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  
Figure 4-1 Serial port and jumper locations  
If B = 32, the sender is not requesting information and  
nothing further should be printed.  
ON C OM $ is useful whe n data is sent in pac kets. This  
multitasking command branches to a BASIC subroutine  
when a specific char acter or number of chara cters is  
received.  
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.  
Another useful function is STR. Strings can be  
formatted, analyzed for length and content. When used  
in conjunction with ON COM $, networ king over RS-485  
is much easier than with the original BASIC-52.  
Page 4-1 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
SERIAL PORTS  
SECTION 4  
Figure 4-2 Network diagram  
RS-422/485 OPERATING INFORMATION  
400 LINEB 5,0,(LINEB(5,0) .AND. 251)  
500 LINEB 5,0,(LINEB(5,0) .OR. 4)  
RS-422/485 Termination network  
Jumper W 4 determines if COM 1 receive is RS-232 or  
RS-422/485.  
When the RPC-320 is the last physical unit on a network  
(RS-485), or it is the only unit (RS-422), the receiver  
must be terminated to prevent ringing. Jumper block  
W5, 6 installs or removes this network. Insert a jumper  
in W5 and W6 to install the network terminator.  
W4[1-2]  
W4[2-3]  
RS-485  
RS-232 (de fault)  
COM1 default is RS-232. Use the CONFIG BAUD  
statement to set the software to RS-422 or RS-485.  
When set to RS-422, the transm itter is always on. RS-  
485 mode turns on the transmitter only when sending.  
Only one slave device on a RS-485 network should have  
a terminator installed. The host transmitter shou ld also  
have a 100 ohm resistor in series with a 0.1 m fd  
capacitor . T he term inator on the RPC -320 includes p ull  
up and pull down resistors to prevent lines from floating  
and generating er roneous char acters.  
Page 4-2 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
SERIAL PORTS  
SECTION 4  
Two wire RS-485  
The RS-485 port on the RPC-320 is set up for 4 wire  
mode. 2- wire mode causes transmitted data to be  
received. T o use the RPC-320 is this mode, your code  
should "flush" the received data or otherwise r emove  
transmitted information.  
Mechanically, to make a 2- wire system, simply connect  
T+ to R+ and T- to R -. M ake sure CON FIG BAUD is  
set up for RS-485 mode.  
Multidrop Network  
Figure 4-3 Data packet  
You can use the RPC-320 in a m ultidrop network by  
using CO M1' s RS-422/ 485 port. You can c onnect up to  
32 units (including other RPC -320' s) over a 4,000 foot  
range.  
The response depends upon the nature of the command.  
Suppose the command M means "return a digital I/O  
port status". T he RPC-320 could rea d the port and  
respond with AA2< cr> . The first A is an  
acknowledge, that is no error s were detected in the  
message. The data, A 2, is a hex number and is broken  
down as follows:  
Figure 4-2 shows an exam ple of a multidrop network.  
This networ k includes a host and one or m ore devices.  
The host transmits data packets to all of the devices, or  
nodes, in the network. A data packet includes an  
address, com mand, data, and a checksum. See figure 4-  
3. The packe t is received by all devices, and ignored by  
all except the one addressed.  
Bit/line  
Status  
7 6 5 4 3 2 1 0  
1 0 1 0 0 0 1 0 = A2  
Lines 1, 5 and 7 are high while the others are low.  
The relationship described below between nodes and the  
host is a maste r-slave. The host dir ects all  
The following program fragment uses ON C OM$ and  
STR in a network environment. ON C OM$ generates an  
interrupt when a < CR> is received. The interr upt  
progr am uses a STR fun ction to deter mine if the da ta  
packet was addressed to this card.  
communication. Nodes "do not speak unless spoken to".  
Peer to peer com munication, while possible with the  
RPC-320, is not discussed here.  
Ther e are m any com munication protoco ls. F or this  
example, a protocol might look som ething like this:  
10 STRING 200,20  
20 ON COM$ 1,0,13,1000  
30 $(1) = ">05"  
> 22M B1  
.
.
.
The pr otocol starts w ith the < cr> charac ter. This  
character synchronizes all units and alerts them that the  
next few characters coming down are address and data.  
In this case, "> 22" is the units address. "M " is the  
comm and and " B1" is the checksum . T he comm and is  
terminated with a < cr> character.  
1000 $(0) = COM$(1)  
1010 A = STR(8,$(0),$(1))  
1020 IF A = 0 THEN RETURN  
.
.
Line 20 sets up ON CO M$ to interrupt on a < CR> and  
branch to line 1000. Line 30 sets up this card' s address.  
Line 1010 checks to see if the received message = this  
card's address. If not, the subroutine ends. When there  
is a match, further processing is performed.  
ACCESSING SERIAL BUFFERS  
Page 4-3 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
SERIAL PORTS  
SECTION 4  
You can access C OM0 and COM 1 buffers in three w ays:  
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  
statement:  
1. INPUT sta tement. This removes all characters 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.  
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.  
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 empty. 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  
GET.  
Comm and  
Function  
CLEAR COM$  
COM$  
COM  
Clears serial input buffer  
Returns string from buffer  
Returns number of characters  
in buffer  
If you don' t read the buffer and the buffer fills, all  
subsequent characters are discarded.  
CONFIG BAUD  
GET  
Sets serial port parameters  
Returns a character fr om the  
serial buffer  
3. COM$(n) retrieves all characters in the buffer,  
including other control codes (except CR).  
INPUT  
LIST  
PRINT  
Receives string from port  
Outputs program listing  
Outputs data in various  
form ats  
ACCESSING COM0 AND COM1  
PRINT #,  
SPC  
STR  
Prints to a specified port  
Print out n number of spaces  
String handling commands  
Tabs to predetermined  
positions  
Reroute inputs to COM0  
Route inputs to COM1  
Rerou te PRIN T statem ent to  
COM0  
INPU T and GET functions retrieve data using the UIn  
comm and. UI0 routes 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.  
TAB  
UI0  
UI1  
UO0  
The following show how UIn and U On work.  
UO1  
Route P RINT statement to  
COM1  
100 UI0  
Set to COM0  
110 INPUT A  
Get data from COM0 port  
USING  
PRINT formatting statement  
520 UI1  
530 INPUT B  
Switch to COM1 port  
Get data from COM1 port  
SERIAL PORT PIN OUT  
Pin outs for J1 and J2 are shown below. Unused pins  
are open.  
800 REM  
810 PRINT "Temperature:",T  
Print to COM0  
900 REM Print to COM 1  
910 PRINT#1, "Set pressure at:",CA  
J1 &  
J2  
Name  
Direction  
from card  
Power up default is set to COM 0.  
3
4
Tx  
RTS*  
Out  
In  
Page 4-4 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
SERIAL PORTS  
SECTION 4  
5
6
RXD  
CTS  
In  
Out  
9
10  
Ground  
+ 5  
*RTS input not in COM0.  
A seria l cable is made by simp ly taking a 10 pin fe male  
IDC connector and crim ping a 9 wir e ribbon c able to it.  
Page 4-5 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
RAM MEMORY  
SECTION 5  
To install a new memory chip:  
INTRODUCTION  
1. Turn off power to the RPC-320.  
32K, 128K, or 512K of RAM may be battery backed on  
the RPC-320. RA M size can be changed at any time.  
RAM is in socket U5.  
2. Remove the mem ory chip from U 5.  
3. Orient the chip so pin 1 is towards the inside.  
If installing a 32K RAM , place the chip at the  
RAM is backed up when a DS1216DM is installed.  
Battery life depends upon RAM size, its power  
consumption, ambient temperature, and amount of time  
the board is operating. Gener ally, a battery life of about  
3 to 5 years is expected . Oper ating the boar d at 50 °C  
reduces battery life by 1/2.  
bottom  
of the socket (m emor y chip pin 1 goes into  
socket pin 3). The top two socket pins in each row  
are empty.  
If installing a 128K or 512K, install the chip into the  
socket.  
The DS1216DM is also a real time clock. Thus, DATE  
and TIM E functions and com mands are available when it  
is installed. See Chapter 7 for more inform ation.  
4. Check and change , as n ecessar y, jum per W 1 to  
conform to the new mem ory.  
This chapter discusses changing RAM, saving and  
retrieving variables, r unning assembly language  
program s, and battery condition. F igure 5-1 shows the  
location of U3 and jumper W1.  
RAM size  
Jumper W1  
32K  
128K  
512K  
[1-2]  
[1-2]  
[2-3]  
Increasing RAM size does not necessarily increase the  
program size RPBASIC-52 can handle. Maximum  
program and variable size is 60K. Additional RAM does  
increase the amount of space available for PEEK and  
POKE storage.  
BATTERY BACKUP  
An optional battery backup module may be installed.  
Principal is the same as installing a RAM chip.  
WARNING:  
An additional modification must be performed to the  
DS1216DM module when a 512K RAM is installed.  
Contact Rem ote Processing fo r details.  
To install a module:  
1. Remove the RAM IC in U5.  
2. Install the DS1216DM in U5.  
3. Re-install the RAM chip into the top of the module.  
Figure 5-1 RAM and W1 jumper location  
CHANGING MEMORY  
Checking the battery  
Battery voltage is approximately 3.0 volts, measured  
between pin 16 (ground) and 30 (128K RAM ), 14 and 28  
(32K RA M), or 16 and 32 (512K RAM ) on the IC itself  
(not the circuit side of the board). Be sure to pow er up  
the RPC -320 once to a ctivate the batter y backup cir cuit  
in the module.  
Different types of memory can be installed at any time.  
RPC-320 models come with either 32K or 128K of RAM  
installed. Maximum is 512K.  
To change a mem ory chip, you need to rem ove the  
original chip, install the new one, and set jumper W 1.  
Page 5-1 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
RAM MEMORY  
SECTION 5  
RESERVED MEMORY  
Many control systems use process variables that are  
operator entered. "variables" in this context include  
numbers, strings, ar rays, recipes, or formulas as applied  
to your application. They are not a part of the variables  
used by Basic. Process variables are accessed by PEEK  
and POK E type statements.  
The upper 512 by tes of mem ory ar e set aside for this  
purpose in a 32K RAM system. In 128K and 512K  
RAM systems, all of the first 64K of RAM is used for  
program and variable stora ge. P rocess var iables in these  
larger versions are stored starting at segment 1 and  
higher.  
Figure 5-2 RPBASIC-52 memory map  
100 POKEB0,7E00H,C  
120 B = PEEKB(0,7E05H)  
When the combined program and data size exceed 30K,  
a 128K or 512K RA M is necessary. Additional R AM is  
necessary when your pr ogram has large ar rays and / or  
string storage r equireme nts.  
The highest address in a 32K RAM system is 7FFFH.  
MTOP should not be used when variables are battery  
backed for power off conditions. Basic clears all of  
RAM in segment 0 (except for the last 512 bytes in a  
32K system) at power up. Store process variables  
starting at segment 1 or higher in a 128K or 512K RAM  
system or start at address 7E00H, segment 0 in a 32K  
RAM system.  
Many times it is desirable to store an array containing a  
"mixed" set of variables. Suppose you needed to save an  
array m ade up of the following elem ents:  
Bytes Type  
Description  
1
Byte  
Job counter  
2
6
20  
Word  
Floating  
String  
Analog output offset  
Corr ection factor  
Job name  
STORING VARIABLES IN RAM  
Program s and RPBASIC-52 var iables reside in segment  
0. D ata is generally stored in segment 1 and higher (a  
segment is 64K of memory). See memor y map figure 5-  
2. "Data Area" is segment 1 or higher.  
Total number of byes required for each array is 30 (add  
1 for a < CR> at the end of the string).  
The Job c ounter is increm ented ever y time it is  
completed. A nalog output offset is an output constant or  
other var iable used to initialize the outputs. Job name is  
used with the display to identify a job.  
PEEK and PO KE commands store and retrieve values  
from memor y. For example:  
20 POKEB1,12,A  
For this example, suppose there are 20 of these arrays  
that need to be set up. A program fragment is as  
follows:  
puts the 8 bit value of A into segment 1, addr ess 12.  
Use the PEEK statement to retrieve the variable:  
100 STRING 400,20 Initialize 20 string arrays  
50 B = PEEKB(1,12)  
300 NO = 12  
Element to fill  
Corr ection factor  
Job counter  
310 CF = 23.432  
320 JC = JC + 1  
330 AC = 25  
Accessing reser ved mem ory in a 32K RAM system is  
accomplished as follow s:  
Analog offset  
350 GOSUB 1000  
500 NO = 5  
Element to retrieve  
Page 5-2 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
RAM MEMORY  
SECTION 5  
510 GOSUB 2000  
Retrieve variables  
This subroutine stores variables CF, JC, and AC into an  
array starting in segment 1, address 0.  
ASSEMBLY LANGUAGE INTERFACE  
1000 POK EB1, 30*NO, JC  
1010 POKEW1,30*NO+ 1,AC  
1020 POKEF1,30*NO+ 3,CF  
1030 POKE$1, 30*NO+ 9,$(0)  
1040 RETURN  
Assembly language program s must be placed in the  
RPBASIC-52 E PROM . W hen using RPBASIC-52,  
progr ams should start at addr ess 6000H or higher up to  
7FFFH.  
RPBASIC is norm ally in a 32K byte EPROM (27C256).  
A 64K byte EPROM (27C512) may be used in socket U4  
provided the following modification is made: Cut the  
trace between W11 pins 1 and 2 on the circuit side.  
(Jumper W11 is under socket U4. P in 1 is designated by  
the square pad.) Solder a jumpe r between W11 pin 2  
and 3.  
Subroutine 2000 - 2040 retrieves data into variables CF,  
JC and AC.  
2000 JC = PEEKB(1,30*NO)  
2010 AC = PEEKW (1,30*N O+ 1)  
2020 $(1) = PEEK$(1, 30*NO+ 9)  
2030 CF = PEEKF (1,30*N O+ 3)  
2040 RETURN  
Docum ented assem bly language interface calls listed in  
the Intel MCS BASIC -52 Users Manual will not work  
with RPBASIC-52. This is because RPBASIC-52 has  
been reassembled and code shifted around.  
You can store and retrieve strings and variab les in this  
way. Ther e are many variations of PEEK and POKE  
statements. Refer to the RPBASIC-52 Software  
Supplement in this manual for additional information and  
examples. A list of comm ands appea rs at the end of this  
chapter.  
The RP-10 adapter boar d is used to run and debug  
assembly and C code. This board plugs into RAM  
socket U5 and RPBASIC socket U4. It does not use the  
Basic at all.  
BLOCK DATA TRANSFER  
COMMANDS  
Blocks of data are transferred to and from RA M and  
flash EPR OM u sing BLOAD and BSAVE comma nds.  
Block transfers are useful for loading and storing data,  
look-up tables, text, etc. U p to 65,535 bytes can be  
moved from RAM to EPROM or EPROM to RAM at  
one time. The absolute number of bytes that are moved  
is limited by the RAM and EPR OM sizes.  
The following is a list of RPBASIC-52 commands used  
with RAM.  
Comm and Function  
BLOAD  
BSAVE  
CALL  
CBY  
DBY  
Transfers data from EPROM to RAM  
Transfers data from RAM to EPROM  
Calls an assembly language routine  
Return s code memor y data  
Returns or assigns internal memory  
Sets top of RAM memory  
Return s a byte  
Returns a floating point number  
Returns a 16 bit value  
Returns a string  
Stores a by te  
Stores a floating point number  
Stores a 16 bit value  
Stores a string  
Returns or assigns external memory  
Transfers from EPRO M to RAM , using BLOA D, take  
approximately 23.5 m s/1000 bytes. T ransfers from  
RAM to EPROM , using BSAVE , are even longer at 100  
ms/ 1000 bytes using a 512K byte EPR OM . T his time is  
even longer when smaller E PROM s are used (due to the  
program ming algorithm).  
MTOP  
PEEK B  
PEEK F  
PEEK W  
PEEK $  
POKE B  
POKE F  
POKE W  
POKE $  
XBY  
Serial port, tick timer, and external interrupts are  
enabled dur ing these transfers. Howe ver, response s to  
ONT ICK or ONIT R are d elayed by the time it takes to  
transfer data. W hen ONTIC K or ONIT R must be  
serviced faster, transfer data in sm aller blocks.  
Refer to BLOAD and BSAVE in Appendix A for more  
information.  
Page 5-3 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
DIGITAL AND OPTO PORTS  
SECTION 6  
technical support for suggestions appropriate to your  
application. Power may be applied to ISOA/B at  
any time.  
INTRODUCTION  
Digital I/ O lines ar e used to inter face with op to-module  
racks, switches, low current LED's, and other TTL  
devices. The RPC-320 has 34 of these lines. 8 TTL I/O  
lines go to a terminal strip. Additionally, there is one  
high curr ent output and a n opto-isolated inp ut. R efer to  
the figure below for the location of these lines.  
Several softwar e comm ands support the digital I/O ports.  
ON L INE br anches to a subroutine w hen a line changes.  
ON C OUN T counts the number of high to low  
transitions at a digital line. Maxim um coun ting rate is  
about 95 Hz. T hese commands simplify design and  
greatly speed up execution. See Appendix A for more  
information.  
Eight lines at P6 are intended for general purpose TTL  
I/O such as switches, level sensors or to drive other  
devices.  
DIGITAL I/O PORTS  
A 24 line con nector, J3, is inte nded to inter face to opto  
racks or other TT L devices. 8 of these lines are high  
curr ent outputs, capable of sink ing 75 to 200 m a. O pto  
modules on an opto rack sense presence of AC or DC  
voltages or switch them.  
All ports use an 82C55 for I/O. Lines are accessed  
using LINE or LINEB commands. Lines at J3 and P6  
are configured for inputs or outputs using the CONF IG  
LINE comm and. See Appendix A for information.  
L8 at P2 is a "zero" ohm FE T switch. It is intended for  
switching L ED b ack lighting on an LC D display. This  
line may also be used to switch high current, high  
voltage power . It can sw itch up to 2 amps.  
WARNING:  
When using CON FIG LIN E, output lines go low  
momentarily (less than 10 micro-seconds) until they  
are set high again as per the data in the command  
line. Some other lines are affected when C ONF IG  
LINE 0 is executed. Refer to CONFIG LINE  
command in Appendix A for more inform ation.  
ISOA/B is used as an isolated input as well as an  
interrupt.  
In addition to the 24 I/O lines from J3, the display port  
can be used as digital I/O. Refer to Chapter 8 for more  
information.  
Digital Por t J3  
This port is used to interface opto modules (using the  
MP S series racks), drive small r elays, solenoids,  
motors, or lamps, and provide general purpose TTL I/O  
to other logic devices or mechanical switches. The  
LINE com mand is use d to access and control this p ort.  
The lines on J3 are divided into 3 eight bit groups from  
an 82C55. Ports A and B are configured as all inputs or  
outputs. Port C is progr amm ed as one gr oup of 8 inputs  
or outputs or as two groups of four lines (upper and  
lower C). T he four lines in upper and lower C can each  
be program med as all inputs or outputs. R efer to T able  
6-1 to determine the opto channel or J3 pin number for a  
port. U se CON FIG LIN E 100 (Appendix A) to  
configure por ts A, B, and C for inputs or outputs.  
Figure 6-1 Digital I/O  
When a line is configured as an output, it can sink a  
maximum of 2. 5 ma at 0.4V and can source over 2. 5  
ma. Outputs sink 15 ma at 1. 0V. This will dr ive opto  
modules. P ort B is connected to a high current sink  
through U12. See "High current output" later.  
WARNING:  
Apply power to the RPC -320 before applying a  
voltage to the digital I/O lines to prevent current  
from flowing in and damaging devices. If you  
cannot apply power to the RPC-320 first, contact  
Digital I/ O lines at J3 m ay be pulled up to + 5 volts or to  
Page 6-1 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
DIGITAL AND OPTO PORTS  
SECTION 6  
to the touch. Consider the maxim um ambient  
ground through a 10K/100K resistor packs using jumper  
W7. 10K is on digital port A only.  
temper ature the b oard w ill operate at. A t 70°C, warm to  
the touch at room temperature m ay be too much.  
Consider adding a heat sink.  
Jumper W7 for pull up or down configuration is as  
follows:  
The PW M com mand m ay be used with this port. Use  
the circuit in Figur e 6-2 when switching induc tive loads.  
Use the "GN D" ter minal next to L8 when switching  
loads.  
W7[1-2]  
W7[2-3]  
Pull up  
Pull down  
Setting W7 for pull up makes interfacing to switches and  
"open collector" TTL devices easy . See "Inter facing to  
Switches and other devices" below.  
Optically Isolated Input  
ISOA a nd ISOB ar e inputs to an optica l isolator. This  
input is read as L8. It can also generate an interrupt  
provided W8[1-2] is jumpered and ONITR is set. Refer  
to Chapter 12 for input voltage and interrupt  
requirements. This line can be used to "wake up" the  
CPU fr om low power IDLE 2 mode.  
Digital Port P6  
Connector P6 has 8 digital I/O lines for general pur pose  
use. Additionally, 3 ground and a + 5V positions are  
provided. + 5V power and gr ound may be brought in or  
taken from this connector. L ines are numbered L 0-L7.  
This por t may be used to interfa ce switches, dr ive small  
LED' s, and provide general purpose TTL I/O to other  
logic devices. Voltage and current param eters are the  
same as J3 except there is no high current output. Port  
C from an 82C55 is used for this I/O.  
The status is read using the LINE(8) function.  
A = LINE(8)  
A 1 is returned when there is no input and a 0 when  
voltage is sufficiently high enough to turn on the isolator  
(about 3.5 volts).  
Upon po wer u p or reset lines L0 to L3 ar e inputs while  
L4 to L7 are outputs. Lines L4 and L5 are low while L6  
and L7 are high at power up. All lines are connected to  
a 10K pull up resistor (R21). Lines are r econfigured for  
all inputs or outputs using the CONFIG LINE 0  
command, found in Appendix A.  
The opto isolator is not polarity sensitive. This input can  
be used in conjunction with or independently of the  
ONIT R statement.  
Digital I/O Commands  
High Current Port L8  
L8 will switch 2 amperes to ground through a "zero  
ohm" FET switch. Maxim um off voltage is + 50 volts  
DC. "ON" resistance is about 0.5 ohm.  
The CON FIG LINE statement is used to configure lines  
at J3 and P6 for inputs a nd outputs. J3 power up default  
is all inputs. P6 pow er up default is L0 to L 3 are inpu ts  
and L4 to L7 are outputs. CONFIG LINE 0 refers to P6  
while CON FIG LIN E 100 to J3.  
Use this port to switch LED back lighting for LCD  
displays on or off under softwar e control.  
The L INE comm and has 3 variations: LIN E, LIN E B,  
and LINE #. Each is described below. See Appendix A  
for more inform ation.  
This line is always an output. Use the LINE 8 com mand  
to turn this line off or on.  
LINE 8,ON  
LINE function and statem ent is used with M PS-XX opto  
rack at J3. It accesses a module according to the  
position number printed on the MPS board. Lines are  
numbered from 100 to 123. The opto module number  
used in this command is computed by adding 100 to the  
board position number. LINE also accesses L0-L 8 on  
P2 and P6.  
LINE 8,1  
Both commands turn on L8.  
The F ET sw itch is rated fo r much higher curr ent.  
However, continuous current is much less without a heat  
sink attached. You may dr aw more than the rated 2  
amps on an intermittent basis. How m uch and for how  
long depend s upon your application. A quick w ay to  
check for excessive current is to touch (VERY  
The LIN E B function and statement is used to acc ess  
CARE FUL LY!) Q2 (next to P2). It can be warm to hot  
Page 6-2 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
DIGITAL AND OPTO PORTS  
SECTION 6  
ON C OUN T and O N LIN E do not ne cessarily h ave to  
be input lines. They can be outputs controlled by  
another part of the program.  
digital I/O lines 8 bits at a time. T he address for port A  
is 0, B is 1, and C is 2. J3 I/O bank number is 3.  
Address for lines L0-L7 at P6 is 2 and I/O bank number  
is 5.  
High Current Output  
LINE # function and statement accesses lines according  
to the pin number at J3. J3 lines are number ed from 101  
to 125. The line number used in this com mand is  
computed by adding 100 to the connector pin number.  
Line 102 is not allowed as it is the + 5V supply. See  
table 6-1 to cor respond a pin numb er to a por t and opto  
rack position.  
Eight lines at J3 can be used as high cur rent driver s.  
These outputs will switch loads to ground. Outputs are  
controlled by Port B on the 82C55.  
Logic outputs are inverted. That is, when a 1 is written  
to the high current port, the output is switched on and  
goes low.  
P6 lines are numbered 0 to 7, and correspond to the  
terminal number on the boar d. The L INE function and  
comm and are used to acc ess these lines. L 8 at P2 is a  
high current output and is accessed using LINE 8. T he  
status of ISOA/B is returned using LINE 8 function.  
The output driver chip, U 12, can be replaced w ith a DIP  
shunt jumper so it is like the other lines at J3. To do  
this, r emove U12. Install a DIP shunt so pin 1 goe s to  
pin 18. Pins 9 & 10 ar e open.  
LINE, LINE B and LIN E # re turn a ' true' logic level.  
A ' 1' indicates + 5 volts or high and a '0' is low or  
ground. LINE B and LINE # output true logic levels.  
LINE, however, outputs inverted logic. In order to turn  
on an opto m odule, a line must go low. Howe ver, to  
turn on a module using LINE, specify ' 1' or ON. High  
curr ent output chip U 12 inverts c ontrol signa ls sent to it,  
regardless of comm and.  
NOTE: Outputs at the high current lines are not  
compatible with TTL logic levels and should not  
be used to drive other logic devices.  
Each of the high current outputs can sink 500 ma at 50V.  
However, package dissipation will be ex ceeded if all  
outputs are used at the maximum rating. The following  
conserv ative guidelines a ssume the number of outputs  
are on simultaneously:  
100 LINE 118,1  
110 LINE 118,ON  
120 LINE#104,0  
:REM Turn opto 118 ON  
:REM Turns opto 118 ON  
:REM also turns 118 ON  
# of outputs  
on  
Maximum current  
per output  
ON LIN E is a multitasking command. W hen active, the  
RPBASIC oper ating system checks the specified line  
every 5 ms. If the line changed state from the previous  
scan, a software interr upt is set. Upon completion of the  
current BASIC command (and assuming no other  
interrupts are active), pr ogram execution branches to a  
specified subroutine. This command is useful for  
monitoring lines, such as limit or door switches, that  
may not change often or when the program structure  
make it unwieldy to check lines frequently.  
1
2
3
4
5
6
7
8
500 ma  
400 ma  
275 ma  
200 ma  
160 ma  
135 ma  
120 ma  
100 ma  
Another multitasking command, ON C OUN T, causes the  
operating system to ch eck the specified line every 5 m s.  
Up to 8 lines are monitored. If the line changed from a  
high-to-low state, a counter is incremented. M aximum  
counting rate is effectively 95 Hz. This command has  
two variations. One causes a software interr upt when a  
specified num ber of co unts is reached. Another simply  
counts pulses at a line. The C OUN T function returns  
the number of pulses since ON CO UNT was initiated.  
See Appendix A for command infor mation.  
The ther mal time constant of the package is very shor t,  
so the number of outputs that are on at any one time  
should include those that overlap even for a few  
milliseconds.  
Incandescent lamps have a " cold" curre nt of 11 times its  
operating current. Lamps requiring more than 50 ma  
should not be used unless a series resistor is installed.  
Page 6-3 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
DIGITAL AND OPTO PORTS  
SECTION 6  
130  
A = LINE#(103)  
Function  
Protection diodes m ust be used with inductive loads.  
Refer to figure 6-2  
Program line 100 turns external opto module rack  
position 0 off. Program line 110 sets J3, pin 3, to a  
logical 0 level. Program line 120 returns the status of  
externa l opto modu le rack po sition 0. If the modu le is  
"off", a 1 is returned (assuming it is an output module).  
Program line 130 returns the status of J3, pin 3 as a 0 or  
1.  
Example: To turn on opto module in slot position 8, the  
following command is executed:  
Figure 6-2 Inductive load protection  
LINE 108, 1  
Do not parallel outputs for higher drive. This could  
result in damage since outputs will not share current  
equally.  
A ' 1' turns on a module while a 0 turns it off. (In actual  
fact, a 0 is written at the port. )  
The outputs at U12 are open collector. An external  
device must supply power.  
See Digital I/ O program ming exam ple later in this  
chapter.  
Interfacing Digital I/O to an opto-module rack  
Interfacing to switches and other devices  
I/O lines at J3 can interface to an MPS-8, 16, or 24  
position opto m odule rac k. L ines not going to an opto  
module connect to a screw terminal on the MPS-XX  
series boards. This feature allows you to connect  
switches or other TTL type devices to the digital I/O  
lines. The MPS-XX series boards accept G4 series  
modules.  
Switches and other digital I/O devices may be connected  
directly to P6 or J3. The STB-26 terminal board  
provides a convenient way of interfacing switches or  
other digital I/ O devices. L ines at J3 are connected to  
the STB-26 with a CMA-26 cable. Digital devices are  
then connected to the screw terminals on the STB-26.  
The M PS-XX serie s opto racks also provide a way to  
access digital I/O lines.  
A CM A-26-24 connects J3 on the RPC-320 to the MP S-  
XX board. Cable length should be less than 2 feet.  
Excessive cable lengths cause a voltage drop and  
consequently unreliable operation. Make sure + 5 V and  
ground is connected to the M PS-XX racks.  
Switches may be connected directly to a line. When  
jumper W7 configures the resistors as pull ups, a switch  
closure to ground at a line is read as a 0 using the LINE  
# function at J1. 10K resistors are always pulled up at  
lines L0 to L7.  
Before a line is set, the 82C55 chip must be initialized.  
This is done using the CONFIG LINE statement. Group  
inputs and outpu ts together. Refer to Table 6-1 for opto  
module position, port number , and connector pin out. If  
opto channels 16-23 are used, U12 should be replaced by  
a DIP shunt jumper.  
When W 7 configures the input re sistors as pull downs,  
one end of the switch m ust be tied to + 5 volts. If this is  
not possible or convenient, a 1K resistor can be tied  
between an input and + 5 volts to force it high when a  
switch is open.  
Digital I/ O prog ramm ing exam ple  
The LINE and LINE # com mands are used to control  
and access opto modules and lines. These commands are  
both functions and statements, depending upon how they  
are used.  
The follow ing exam ple reads a switch at port A, bit 3  
(J3-25) (program line 200), r eads L1 at P6 (program line  
210) and turns on opto module at channel 5 (program  
line 220). A LE D is controlled through the high current  
port at J3-10 (port B, bit 0) (program lines 230 and 240).  
For testing, a 100 ohm resistor from J3-10 to + 5 volts  
can be substituted.  
100 LINE 100, 0  
Statement  
Statement  
Function  
110 LINE #103, 0  
120 A = LINE(100)  
Page 6-4 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
DIGITAL AND OPTO PORTS  
SECTION 6  
100 CON FIG LIN E 100,13, 1,1, 1  
200 D = LINE #(125)  
210 F = LINE (1)  
220 LINE 105, 1  
230 LINE #110,1 :REM Turn on LED  
240 LINE #110,0 :REM Turn off LED  
Line 100 configured the 82C55 so ports A and C are  
inputs while B is the output.  
Note that the LINE statement is used to control both opto  
modules and individual lines.  
Lines can also be read or controlled in the imme diate  
mode.  
PRINT LINE#(125)  
returns the status at J3-25. Notice that even when a line  
is configured as an output, its status can be read back.  
Execute the following to control L7.  
LINE 7,OFF  
sets L7 low. E xecuting  
LINE 7,ON  
sets the line high.  
LINEB is used to read and write a byte at a time.  
LINEB 3,1,128  
sets port B, bit 7 high and bits 0-6 are low.  
Pulse Width Modulation (PWM)  
Any line accessible by the L INE com mand m ay be pulse  
width modulated. PW M comm and parameters determ ine  
high and low time (to 5 ms resolution) and, optionally,  
number of pulses.  
Use PW M to control the brightness of a display (via line  
8), control the speed of a motor, or output a number of  
pulses to a stepper controller. Brightness control using  
LED ' s is best achieved when htime or ltime are less than  
5 (25 ms). O ne of the parameters should be 1.  
Noticeable flicker occurs when htime and ltime sum to  
more than 6 (30 ms).  
See the PWM comm and in the Software Supplement for  
more inform ation. Use Table 6-1 to use an output  
directly from J3.  
Page 6-5 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
DIGITAL AND OPTO PORTS  
SECTION 6  
Table 6-1 Connector pin ou t - J3  
Pin #  
82C55  
Description  
Opto  
Channel  
19  
21  
23  
25  
24  
22  
20  
18  
Port A, line 0  
Port A, line 1  
Port A, line 2  
Port A, line 3  
Port A, line 4  
Port A, line 5  
Port A, line 6  
Port A, line 7  
8
9
10  
11  
12  
13  
14  
15  
10  
8
4
6
1
3
5
7
Port B, line 0  
Port B, line 1  
Port B, line 2  
Port B, line 3  
Port B, line 4  
Port B, line 5  
Port B, line 6  
Port B, line 7  
High current  
High current  
High current  
High current  
High current  
High current  
High current  
High current  
16  
17  
18  
19  
20  
21  
22  
23  
13  
16  
15  
17  
14  
11  
12  
9
Port C, line 0 Lower C  
Port C, line 1 Lower C  
Port C, line 2 Lower C  
Port C, line 3 Lower C  
Port C, line 4 Upper C  
Port C, line 5 Upper C  
Port C, line 6 Upper C  
Port C, line 7 Upper C  
0
1
2
3
4
5
6
7
26  
2
Ground  
+ 5V  
Figure 6-3 Digital I/O connector pin out (viewed from top)  
Page 6-6 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
DIGITAL AND OPTO PORTS  
SECTION 6  
COMMANDS  
The following tables shows the RPBASIC-52 comm ands  
used for digital I/O.  
Comm and  
Function  
CONFIG LINE Configures I/ O ports  
COUNT  
LINE  
Returns number of pulses at a line.  
Function returns status of an opto  
module as a 0 or 1.  
LINE  
Statemen t turns on or off an opto  
module.  
LINE B  
LINE B  
LINE #  
LINE #  
ON COUNT  
ON LINE  
PWM  
Function returns 8 data bits from any  
I/O type device.  
Statement writes 8 data bits to any I/O  
type device.  
Function re turns status of line at J3  
connector as a 0 or 1.  
Statement wr ites data to a line at J3  
connector as a 0 or 1.  
Counts pulses and optional generates an  
interrupt.  
Generates an interrupt when a line  
changes.  
Sets PWM param eters for any line.  
Page 6-7 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
CALENDAR/CLOCK  
SECTION 7  
NOTE: The clock module is turned off as shipped from  
the factory. DATE and TIME functions return  
a HARDW ARE erro r until DA TE is set first.  
DESCRIPTION  
An optional DS1216DM calendar/clock module m ay be  
installed in U5. The DS1216D M also battery backs  
RAM.  
To retrieve date and time as part of a program:  
100 PRINT "Time: ",  
110 FOR N=0 TO 2  
120 PRINT TIME(N),  
130 NEXT  
140 PRINT "Date: ",  
150 FOR N=0 TO 2  
160 PRINT DATE(N),  
170 NEXT  
The DS1216DM from Remote Processing is a modified  
version of the Dallas DS1216D. An internal reset line  
has been cut. When a 512K RAM is installed, an  
additional line is cut and another soldered. Contact  
Remote P rocessing for de tails.  
180 PRINT CR,  
190 GOTO 100  
Battery life depends greatly upon the ambient  
temperature. Battery life degrades up to 50% at 50°C,  
using 25°C as a refer ence. RAM size and type also  
affect battery life. Generally, you can expect a battery  
life of 3 to 5 years.  
run  
Time: 13 24 12 Date: 94 11 14  
When the clock module is missing, defective, or the date  
has not been set, a HARD WARE er ror (code 50 at  
address 101H) is returned by RPBASIC when a DATE  
or TIM E function is performed. Use ONE RR to trap for  
this error and report the problem.  
Accuracy is about 1 minute/month and is not adjustable.  
Hour s are exp ressed in 24-hour fo rma t.  
Refer to the RPBASIC -52 Software Supplement for  
more com mand information.  
COMMANDS  
The clock module is installed by first r emoving the IC in  
U5. Then, install the DS1216DM into the socket. Install  
the RAM chip into the socket. W hen installing a 32K  
RAM chip, the top two pins in the DS1216DM ar e left  
open.  
The following is a list of RPBASIC-52 commands for  
the calendar/clock.  
Comm and  
Function  
Refer to CHAPTER 5 for information about using battery  
backed RAM and jumper setting when installing a 512K  
RAM.  
DATE  
DAT E(n)  
TIME  
Sets date and tur ns on mod ule  
Return s date  
Sets time  
TIME (n)  
Returns time  
WARNING: An additional modification to the  
DS1216DM is necessary when  
installing a 512K RAM. C ontact  
Remote P rocessing for de tails.  
SETTING DATE AND TIME  
Set the date to turn on the clock module. Date and time  
are set w hile running a progr am or in the imm ediate  
mode. Date and time are treated as number s and not  
strings. To set the date and time:  
DATE 95,11,28  
TIME 13,23,43  
The time is set to 1:23:43 PM.  
Page 7-1 RPC-320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
CALENDAR/CLOCK  
SECTION 7  
Figure 7-1 Calendar/Clock  
Page 7-2 RPC-320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
DISPLAY PORT  
SECTION 8  
INTRODUCTION  
Additional power wiring is usually required for LCD  
graphic and VF charac ter displays. This infor mation is  
included with the display. Information content is display  
dependent. Below is general information on both.  
RPBASIC-52 and the RP C-320 interface to a variety of  
displays:  
VF (vacuum florescent) character  
LCD (liquid crystal) character  
LCD gr aphics  
Graphic displays require additional voltages not  
generated on the RPC-320. These must be supplied  
externally. An external contrast adjustment may be  
necessary. Y ou may be able to connect these through  
screw term inal block P5.  
Character display sizes range from four lines by 20  
characters to four lines by 40 characters. The graphics  
display supports 160 x 128 pixels. Remote Processing  
supplies these displays with appropr iate cables. A  
contrast adjustment fo r LC D char acter displays is built  
into the card.  
VF c haracte r displays r equire + 5 volts and gr ound to  
connector P5. This may in the form of external wires  
from the main power connector on the board or power  
supply.  
If a display is not used, this port may be used for general  
purpose digital I/O. P ort A and part of port B from an  
82C55 are available. See CONNE CTOR D ISPLAY PIN  
OUT below for ava ilable lines.  
Additional information for commands m entioned in the  
following text are found in the RPBASIC-52 Software  
Supplem ent in this manual.  
WRITING TO THE DISPLAY  
The cable length to a display depends upon the amount  
of current it requires. A significant amount of voltage  
drop occurs with a long cable. V acuum florescent and  
The display type must first be set using the CON FIG  
DISPLAY command. T he DISPLAY com mand is used  
to print information.  
LCD graphics cables should b e less than 2 feet.  
A
charac ter LC D display c able should be less than 5 feet.  
PROGRAMMING EXAMPLE  
The example below is for a four line by 20 character  
LCD display. Even though DISPL AY statements do not  
end with a comma (, ), a < cr> < lf> sequence is not  
sent. Use C R to force a return to the beginning of the  
line. A CR does not scroll characters on a display. You  
must position the cursor to the next line.  
10 CONFIG DISPLAY 1  
20 STRING 200,30  
30 $(0) = "Hello world"  
40 DISPLAY (1,2),$(0)  
Figure 8-1 Display interface  
CONNECTING DISPLAYS  
The display port is designed to supply all the lines  
necessar y for V F and L CD displays. A custom cable  
connects the RPC-320 to the display.  
Displays purchased from Remote Processing include a  
cable. You simply connect the 20 pin connector to the  
RPC-320 L CD display port and the other end into the  
display.  
Page 8-1 RPC-320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
DISPLAY PORT  
SECTION 8  
DISPLAY TYPES  
COMMANDS  
RPBASIC-52' s software driver is based upon the  
characteristics of the display family. Compatible VF and  
LCD displays are shown below:  
The following RPBASIC-52 com mands are used for the  
display.  
Manu fact.  
Model  
Type  
Comm and  
Function  
Optrex  
Optrex  
IEEE  
DMC 40457  
DMC 40202  
3601-90-080  
DMF 682N  
LCD 4 x 40  
LCD 2 x 40  
VF 4 x 20  
LCD 160W x 128D  
CLEAR DISPLAY  
CLEAR DISPLAY LINE Clears curr ent line  
CONFIG DISPLAY  
Clears entire display  
Specifies display type to  
use  
Optrex  
DISPLAY  
Prints the string at the  
row and collum specified  
DISPLAY CONNECTOR PIN OUT  
The display port uses an 82C5 5 for data and contr ol.  
The table below lists a pin number and its intended  
function. A display may not use all lines even though  
they are available.  
J4  
8255  
Function  
Pin  
Port/line  
1
Logic + 5V  
2
Digital ground  
3
A/4  
D4  
4
Contrast voltage  
5
6
7
8
A/6  
A/5  
B/4  
B/3  
B/2  
A/7  
A/1  
A/0  
A/3  
A/2  
B/7  
B/6  
B/5  
D6  
D5  
Reset (from invertor)  
Write  
Read  
D7  
D1  
D0  
D3  
D2  
CS (from invertor)  
Com mand/ data  
Halt  
Contrast adjust  
Alternate power  
Power gr ound  
9
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
J4 is available for additional I/O if a display is not used.  
Port A is configured as an input or output. P ort B must  
be configur ed as an outpu t if a 17 key or larger keypad is  
used. Use the L INE B comm and to access this part.  
I/O bank is 4.  
Pins 18, 19, and 20 are for the LCD -5003 and other  
graphic displays.  
Page 8-2 RPC-320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
KEYPAD PORT  
SECTION 9  
INTRODUCTION  
10 STRING 200,20  
20 $(0) = "123A456B789C*0#D"  
30 P = 1  
40 PF = 0  
50 PRINT "Enter a number from the keypad",  
16, 20, or 24 position keypads are plugged into keypad  
port J5. Keys are arra nged in a m atrix for mat. A key is  
recogn ized when a row and a colum n connect.  
REM Rest of program continues  
REM Scan keypad and update display  
RPBASIC-52 scans and debounces the keypad every 50  
ms. Keypad pr esses are returned as a num ber fr om 1 to  
24 using the KE YPA D function . Ke ypad scanning is  
always active and cannot be turned off. Up to 8 key  
presses are buffered.  
200 GOSUB 500  
210 IF PF = 0 THEN 200  
220 PRINT  
230 PRINT "Entered string is: ",$(2)  
240 PF = 0  
250 GOTO 50  
Keypad presses are multi-tasked using ON KEYPAD.  
When a key is pressed, the program br anches to the  
subroutine.  
500 A = KEYPAD(0)  
510 IF A = 0 THEN 500  
520 IF A = 12 THEN 600 : REM Process clear  
530 IF A = 16 then 700 : REM process enter  
540 A=ASC($(0),A)  
550 PRINT CHR(A),  
560 ASC($(2),P) = A  
570 P = P + 1  
Keypads from Rem ote Processing simply plug into J5.  
The keypad cable length should be limited to less than 5  
feet.  
580 ASC($(2),P) = 13  
590 RETURN  
600 REM Clear input string  
610 $(2) = ""  
620 P = 1  
630 RETURN  
700 REM Enter processing  
710 P = 1  
720 PF = 1  
730 RETURN  
Program explanation  
Line 20 defines the keypad legend. Letters may be  
redefined as necessary.  
Figure 9-1 Keypad connector  
Line 30 sets the position counter used to insert characters  
into the string.  
PROGRAMMING EXAMPLE  
Line 200 w aits for a key press. The enter ed string is  
printed.  
The following example sets up RPBASIC to scan a 16  
position keypad. T he results are echo ' ed when a key is  
pressed. Press the 'D' key to enter.  
Line 500 checks the keypad. If a character is available,  
it processe s it.  
Lines 540-590 update the input string and position. A  
< CR> is inserted to mark the end of string.  
Page 9-1 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
KEYPAD PORT  
SECTION 9  
The second example uses ON KEYPAD to generate an  
interrupt every time a key is pressed.  
KEYPAD PORT PIN OUT - J5  
The keypad port uses ports B and C from an 82C55.  
Lowe r por t C is configured as an input. Upper port C  
and port B bits 0 and 1 are ou tputs.  
10 ON KEYPAD1000  
.
.
.
500 GOTO 500  
The table b elow lists J5' s pin out, 82C55 p ort and bit,  
and its intended function.  
1000 PRINT KEYPAD(0)  
1100 RETURN  
Pin  
82C55  
Function  
Line 10 sets up the tasker for keypad interrupts to start at  
line 1000. Line 500 loops on itself for demonstration  
purposes.  
Port/ bit  
1
2
3
4
5
6
7
8
9
C/0  
C/6  
C/5  
C/1  
C/2  
C/4  
C/7  
C/3  
B/0  
B/1  
Row 1  
Column 3  
Column 2  
Row 2  
Line 1000 prints out the key pad position pressed.  
Elements of the pr evious program can be com bined with  
this one to produce keypad strings.  
Row 3  
Column 1  
Column 4  
Row 4  
Column 5  
Column 6  
10  
Page 9-2 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
ANALOG INPUT  
SECTION 10  
usually affects readings on other channels.  
DESCRIPTION  
Grounding  
The RP C-320 has 8 single ended analog input channels.  
These channels are used to measure voltages from  
transducers, 4-20ma current loops, thermistors, etc.  
Input voltage r ange is 0 to 5 volts or ±2.5V with 12 bit  
(4096 count) resolution. Signals are single ended or  
differential. Input impedance is 100K ohms to ground.  
Analog ground is somewhat isolated from digital ground.  
While the ground plane is connected between the two,  
analog ground is a virtual "island" connected only in one  
place to digital ground. To minimize noise pickup, the  
sending device should be connected to analog ground  
(located at the analog input ter minal str ip). W hen both  
analog and digital grounds come from the same device,  
you will have to play around with the g rounds to  
determine which scheme provides the best performance  
for your system.  
Reference IC U 14 has a voltage output that corresponds  
to the IC tem peratur e. T his output ma y be used to  
measure ambient temperature.  
Two am plifiers are available to signal condition inputs.  
By installing appr opriate r esistors and capacitor s, inputs  
are buffered, amplified, and filtered.  
This chapter begins with basic information on connecting  
and using ana log inputs. Later, descriptions of how to  
measure voltages other than 2.5 or 5 volts, temperature  
measurem ent, data logging, using the amplifiers, and  
calibration are presented.  
CONNECTING ANALOG INPUTS  
All analog inputs interface through connector P4.  
Additional compone nts, such as r esistors and capacitors,  
may be conne cted directly to the screw terminals.  
Figure 10-1 Analog I/O  
INITIALIZATION  
For gr eatest accuracy, connect unused inputs to ground.  
Each channel is initialized for 0-5V, single ended input  
upon power up. Inputs can be reconfigured for eight  
single-ended, four differential, or a mixture of single-  
ended and differential inputs. Input voltage ranges are 0  
to 5V or ±2.5V for any single-ended channel or  
differential pair. Syntax is:  
R17 is adjusted to trim accuracy to your system. See  
Calibration later in this chapter for more information.  
Tem peratur e output or other signa l input may go directly  
to channel 0 via header H1. See Temperature  
Measurement and Amplifiers below.  
CONFIG AIN channel,mode, range  
Overvoltage conditions  
Inputs are protected over voltage protected. M aximum  
voltage on 1 channel is 25 volts. M aximum voltage for  
2 to 4 channels is 12 volts. Total input current m ay not  
exceed 16 ma on all channels. Each channels input  
current is computed by the following formula:  
channel ranges from 0 to 7 for single-ended inputs.  
Differential inputs use adjace nt channels.  
mode defines single-ended or differential. 0 =  
differential, 1 = single-ended.  
Iin = (Vin - 5)/4700  
Differential inputs operate in a special way. The  
polarity of the input signal must be connected as shown  
for an even or odd channel. For exam ple, when channel  
is odd (1, 3, 5, or 7), channel 0 m ust be more negative  
than channel 1 otherwise a 0 is returned. Should the  
relative polarity change, configure the even channel for  
differential input and perform an AIN on it. Use the  
When Vin  
<
5 volts, no curr ent flows into the channel.  
NOTE: An over-voltage condition on one channel  
Page 10-1 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
ANALOG INPUT  
SECTION 10  
Perform a conver sion as normal:  
following tables for differ ential inputs.  
A = AIN(0)  
When channel = odd  
The difference between channel 0 and 1 is returned.  
When channel 1 is more positive than channel 0, the  
result is zero. The differenc e is read on channel 1 by  
performing:  
Pol.  
CH #  
-
0
+
1
-
2
+
3
-
4
+
5
-
6
+
7
channel  
1
3
2
5
4
7
6
A = AIN(1)  
When channel = even  
Pol.  
CH #  
+
0
-
1
+
2
-
3
+
4
-
5
+
6
-
7
Single-ended, ±2.5V input  
CONFIG AIN channel,1,0  
channel  
0
The result is 0 for -2.500V input, 2048 for 0. 000V, and  
4095 for + 2.4988V.  
When range = 0, the input is ±2.5 volts and a 1 = 0 to  
5 volts.  
Acquiring Analog Data  
Differential Mode  
When differential m ode is specified, inpu ts are actually  
pseudo-differential. What this means is that a ground  
reference is needed. For example, you cannot place a  
battery be tween channel 0 and 1 and get an accurate  
reading. T he (-) input must be referenced to ground.  
An example of where pseudo-differential works is an  
output from a bridge network.  
Analog data is accessed with the AIN function. The  
syntax is:  
A = AIN(channel)  
This function assigns the analog value of a channel to the  
variable; A in this case. The value returned is alway s in  
the 0 to 4095 range bec ause the converter is 12 bits.  
Power up or reset default configures inputs to the 0-5V  
range, single ended.  
A pseudo-differential input subtracts the DC component  
from an input. T he IC maker recomm ends the (-) input  
remain stable within 1 count with respect to ground for  
best results. Connecting a 0. 1 uF capacitor from the (-)  
input to grou nd wor ks well.  
To view the result of a conversion in the command  
mode, type:  
When operating in differential mode, r elative + and -  
voltages must be connected to specific inputs. When  
inputs are reversed, a conversion returns a 0. When the  
relative voltage changes, perform a conversion on the  
alternate c hannel. CON FIG AIN is perfor med on b oth  
channels.  
print ain(0)  
The result at channel 0 is returned. T he returned value  
will always be in the 0 to 4095 range. When using a  
channel in the ±2. 5V ra nge, the value returned is  
interpreted differently. Zero count is now -2.500V,  
4095 is + 4.9988, and 2048 is 0.000V.  
Pairs of channels can be differ ential while others single  
ended. Thus, if channel 0 and 1 are differ ential inputs,  
channels 2-7 may be single ended.  
Use the following formulas to convert a returned number  
to a voltage:  
Examples u sing CON FIG AIN  
0 - 5V A = .001221 * AIN(channel)  
Below are sample syntaxes for CO NFIG AIN  
Differential, 0 to + 5V input  
±2.5V A = .001221 * ain(channel) - 2.5  
The AIN function require s about 1.5 ms to convert the  
data. Additional time is needed to store the data. The  
example below takes 255 data samples and stores them  
CON FIG AIN 0,0, 1  
CON FIG AIN 1,0, 1  
Page 10-2 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
ANALOG INPUT  
SECTION 10  
period of time (several seconds if possible).  
into an array which requires 6 bytes per entry. The  
second example takes only two byes per entry, can save  
to extended m emor y, but requir es a longer time to get a  
data point.  
Another way is place a capacitor (0.1 to 1 mfd) between  
the input terminal and ground. This is useful when the  
source resistance is high.  
The pr ogram below take s about 1. 5 ms per data point.  
Noise is, by definition, random . If you wer e to plot out  
the deviations from a norm, it would roughly resemble a  
bell shaped curve. Exper iments on the RPC-320 have  
shown that 99% of the readings are w ithin the ±3 count  
reading and 60% are ±1 count. Noise readings were  
made with all inputs shorted to ground.  
10 DIM A(254)  
20 FOR X=0 TO 254  
30 A(X) = AIN(0)  
40 NEXT  
This next program saves data above MTOP . M TOP was  
previously set. However, if you have 128K or more  
RAM, you can POKE into segment 1 or higher. It takes  
approximately 2 mS per data point and is not affected by  
the memory location saved to.  
Temperature Measurement  
Refer ence IC U14 outputs a voltage pr oportiona l to its  
temperature. This information is used to determine  
approximate ambient temper ature in order to turn on  
fans or heater s.  
10 A = 30000  
20 FOR X=0 TO 999  
30 POKE W0,A,AIN(0)  
40 A=A+2  
50 NEXT  
Vo = 2.1(T + 273)  
or  
Data is retrieved using the PEEK W command.  
T = Vo/2. 1 - 273  
or  
Noise Notes  
T = Vc * .581428 - 273  
An input channel can appear noisy (change readings at  
random) if unused inputs are allowed to float. To  
minimize noise (and increase accura cy), connect all  
unused inputs to ground.  
Where T =  
Vo =  
Vc =  
Te mp er atu re in °C  
Output voltage in mV  
Count returned using AIN , 0 -  
5V range  
A high im pedance inp ut is, by definition, sensitive to  
voltage pickup. Noise is minimized by running wires  
away from A C power lines. A low impedance voltage  
source helps to reduce noise pick up. Shielded cable can  
help reduce noise from high impedance sources. Make  
sure the shield is not used for power ground. U sing the  
shield for power ground defeats its purpose.  
At 25°C the output voltage is approximately 625 mV, or  
506 counts. Vo is expressed as a milli-volt number  
(625) not .625.  
The output from U14 must be buffered. To measure  
temperature, jumper H1[1-3]. Remove resistor R13.  
Jumper H1[2-4]. Tem perature is read at analog channel  
0. T he sensitivity is incr eased by jum pering H 1[5-7] to  
ground. T his will double the output voltage and any  
voltage changes due to temperature.  
Wire pairs can also be twisted. 5-6 twists/foot provides  
a reasonable amount of noise cancellation.  
Noise is defined in this section as any random change  
from a known input. The amount of noise you can  
expect under nor mal operatin g circumstances is ±3  
counts for any input range.  
100 T = AIN(0) * .581428 - 273  
T retur ns the tempera ture in celsius.  
Sensitivity is increased by jumpering H1[5-7] to ground.  
This doubles the output voltage and any voltage changes  
due to temperature.  
One way to compensate for noise is to take a number of  
samples and average the results. Taking 6 or more  
samples would, in theory, cancel out any effects of  
noise. A problem with this is noise tends to group  
together. Ta king 6 readings at one time might show no  
change fr om the norm. Another 6 reading s might be all  
high. If possible, try to spread out readings over a  
NOTE: Tem peratur e measu rem ents are a pproxim ate  
and are meant as a guide to indicate ambient  
temperature.  
Page 10-3 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
ANALOG INPUT  
SECTION 10  
The outpu t from the temperatur e sensor v aries fr om unit  
to unit. Self heating effects as well as supply voltage  
will change the output.  
Page 10-4 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
ANALOG INPUT  
SECTION 10  
The outpu t voltage fro m the tem peratur e sensor is  
doubled by jumpering H1[5-7]. While this does not  
change the range the unit operates at, it does change  
increase temperature m easurement sensitivity.  
Data logging on a timer tick  
Some applications require that data is read at fixed  
intervals. The ONTICK con struct is used to take data in  
intervals from 0. 01 to 327 seconds. The exam ple below  
takes 1 sample per second until 100 samples have been  
obtained.  
10 DIM A(100)  
20 ONTICK 1,500  
30 REM THE REST OF YOUR PROGRAM  
40 REM CONTINUES  
80 GOTO 30  
500 A(N) = AIN(3)  
510 N=N+1  
520 IF N = 100 THEN ONTICK 0,500  
530 RETI  
MEASURING HIGHER VOLTAGES  
Voltages higher than + 5V are measur ed by inserting a  
series r esistor to the inp ut.  
The table below shows resistor values for some input  
voltages using the 0-5V range.  
Maximum  
Input Voltage  
Resistor  
6
20K  
12.5  
24  
150K  
380K  
Use the following formula to determine the series  
resistance necessar y for a m aximum voltage input:  
Rs = Vi * 20000 - 100000  
Rs = Vi * 40000 - 100000  
0 - 5V range  
0 - 2.5V r ange  
Rs is the resistor value in ohms in ser ies with the input.  
Vi is the maximum input voltage. W hen Rs is negative  
or zero, a series resistor is not necessary.  
A high Rs v alue can cause noisy readings. This is  
because the resistor acts as an antenna. To reduce noise,  
place a 0.1 mfd to 1 mfd capacitor betw een the input  
terminal and ground.  
NOTE: When an input voltage exceeds the input range,  
other channel values are affected.  
Page 10-5 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
ANALOG INPUT  
SECTION 10  
K = 200/3276  
K = .06105  
CONVERTING ANALOG  
MEASUREMENTS  
Inputs are converted to "real numbe rs" by perfor ming  
scaling calculations in the program. The AIN function  
returns values from 0 to 4095. To change these numbers  
into something more meaningful, use the following  
formula:  
There is one addition factor. Since the lowest value read  
is 1 V, this offset is subtracted from all readings. A 1 V  
offset is 1/5 of 4095 counts, or 819. The program line  
then becomes:  
200 A=.06105*(AIN(N)-819)  
var = K * AIN(n)  
Note that if the current loop line breaks, a negative value  
is returned.  
n is the analog channel to read. K is the scaling  
constant. K is obtained by dividing the highest number  
in the range of units by the maximum AIN count (4095).  
AMPLIFIERS  
Example 1: To measure the results of an A/D  
conversion in volts and the voltage range is 0 to 5V,  
divided 5 by 4095 to obtain K.  
Two operational amplifiers are available to signal  
condition inputs. Each amplifier is configured as shown  
below.  
K = 5/4095  
K = .001221  
Your program could look something like:  
1000 C = .001221 * AIN(N)  
Example 2: Y ou want to measure a 0 to 200 PSI  
pressure transducer w ith a 0 to + 5V output. Divide 200  
by 4095 to obtain the constant K.  
K = 200 / 4095  
K = .0488  
Figure 10-2 Amplifier circuit  
The code can then look like:  
1000 B = .0488 * AIN(0)  
Amplifiers are accessed through header connector H1.  
Pin out is as follows:  
Measuring 4-20 mA current loops  
H1 pin  
Function  
Curr ent loops is a convenient way to transmit a value  
and still assure the integrity of the signal. If the line  
should break, a 0 volt (or nearly so) is returned.  
1
2
3
4
5
6
Temper ature output from U14  
To channel 0 analog input  
Non-inverting input, amplifier A  
Output from amplifier A  
Inverting input, amplifier A  
Approximately + 7V supply (5 ma  
maximum)  
A 4-20 ma curr ent loop is converted to 1 - 5V by placing  
a 250 ohm resistor across the input of the chan nel to  
ground.  
Cur rent loop r eadings ar e conver ted to engineer ing units  
by performing scaling as described earlier. Since the  
measur ement r ange is 1 to 5V , the count ran ge is  
reduced by 20% to 3276.  
7
8
9
10  
Ground  
Ground  
Non-inverting input, amplifier B  
Approximately -7V supply (5 ma  
maximum)  
11  
12  
Inverting input, amplifier A  
Output from amplifier A  
If pressure were measured:  
Page 10-6 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
ANALOG INPUT  
SECTION 10  
Voltage outputs from pins 6 and 10 are generated by the  
RS-232 chip U8. Both of these voltages go through a  
100 ohm resistor to H1-10 and H1-6. Pin 10 goes to 0  
volts when operating the board in IDLE m odes 1 or 2.  
Pin 6 goes to about + 5 volts. These voltages may be  
used to supply power to very low pow er amplifier s.  
CALIBRATION  
The A /D comes fa ctory calibrated for a 0 to 5V input.  
This range is chan ged by adjusting R17. You can adjust  
the range to 5.12V. This is useful when the input is 0 -  
5V and you want to know when the input is over-range.  
To calibrate or adjust the voltage reference:  
1. Connect the voltmeter ground to a GN D point  
on the Analog IN terminal strip. Make sure  
there are no other connections to the analog  
ground.  
2. Connect the voltmeter ' + ' lead to U14, pin 6.  
3. Adjust R5 for 5.00 VDC or other voltage as  
desired. D o not exceed 5.2 or go below 4. 8  
volts.  
COMMANDS  
The following RPBASIC-52 com mands are used for  
analog I/ O. Mor e inform ation is found in the appendix  
of this manu al.  
Comm and  
Function  
AIN(n)  
CON FIG AIN (n)  
Returns analog value.  
Configures analog input  
channels  
Page 10-7 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
WATCHDOG TIMER  
SECTION 11  
DESCRIPTION  
The watchdog timer is used to reset the RPC -320 if the  
program or CPU "crashes" . The time r is built into the  
80C320 CP U. Timed access requirem ents built into the  
CPU make it high ly unlikely an er rant pr ocessor would  
cancel a watchdog timer.  
The watchdog should not be used in loops which do not  
end quickly or ar e of indetermina te duration unless a  
WDOG command is included. An example of an  
indeterminate loop is one that waits for a port condition  
to change.  
The timer is set by executing a WDOG n command. n is  
0, 1, or 2. 0 turns off the timer. 1 sets the watch dog  
time to 380 ms while 2 sets it to 2.8 seconds. Executing  
WDO G by itself resets the timer. WD OG must be  
executed pe riodically to prevent a reset.  
When the watchdog times out, a softwar e reset is  
perfor med. The effect is lines at J3 do not ch ange as in  
a power-up or har dware reset. Lines at P6, display, and  
keypad port ar e reset to power -up conditions.  
EXTERNAL RESET  
The card is reset externally by mom entarily shorting  
W10[1-2]. R eset is also achiev ed by shor ting W10-2 to  
ground. Maintain this short for at least 10 ms. The card  
will then reset for abo ut 350 ms.  
Page 11-1 RPC-320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
EXTERNAL INTERRUPT  
SECTION 12  
INTERRUPT CHARACTERISTICS  
DESCRIPTION  
Interrupts are negative going edge sensitive. This means  
an interrupt is detected when P2-INT goes low or when a  
voltage is applied to P2-ISOA and ISOB for at least 10  
micro-seconds. To detect a subsequent interrupt, the  
line must go high at P2-INT or voltage removed at P 2-  
ISOA/ B for at least 10 micro -seconds.  
There are tw o sources of interrupts the ONITR statement  
respond s to: Inter nal and exter nal. External interr upts  
are off-card. Internal interrupts are from the counter.  
External interrupts are used to "w ake-up" the card from  
any of the IDLE modes. This feature is useful in power  
conserving m odes.  
The status of the interrupt or ISOA/B line is read using  
the following statement:  
Signals to P2-ISOA and P2-ISOB are optically isolated.  
P2-IN T is a non-isolated, TTL input. Only 1 inter rupt is  
selected. Available interrup ts are show n in the table  
below.  
100  
A = LINE(8)  
When A = 1, P 2-INT is high or no v oltage is applied to  
ISOA /B.  
W8 P in  
1-2  
Description  
The P2-INT goes to the output from the opto-isolator I1.  
Since this line goes to a 10K ohm pull-up resistor,  
additional devices can generate an interrupt only if they  
are "wired-or".  
External TTL level through P2 (INT)  
or optically isolated through P2 (ISOA  
& ISO B)  
3-4  
5-6  
7-8  
Carry or borr ow pulse from counter  
Carry pulse from counter  
Borrow pulse from counter  
PROGRAM EXAMPLE  
The following program enables interrupts and goes to a  
routine to service it. Jumper W8[1-2] and bring P2-INT  
to ground to see this example work.  
ONINT selection is through jumper W8. This chapter  
descr ibes using external inter rupts P 2-INT or ISOA /B.  
When a counter is used, then external interr upts may not  
be used. See Chapter 14, C ounter Inputs for more  
information.  
10 ONITR 500  
30 GOTO 30  
500 PRINT "Got Interrupt"  
510 RETI  
External interrupt at P2-INT is TTL level compatible.  
Bringing this line low generates an interrupt when  
ONITR is enabled.  
Line 510 is necessary to re-enable all interru pts. If this  
line is not executed, but a RETURN is used, then  
ONT ICK is also d isabled. If your pr ogram requir ements  
require disabling all interrupts for a time, then the RETI  
statement can be executed within any subroutine to re-  
OPTICALLY ISOLATED INTERRUPT  
ISOA and ISOB provide an isolated, higher voltage  
input. Neither input is connected to ground or + 5V and  
is isolated to the card by at least 500 volts.  
An external voltage of at least 3.5 volts, any polarity,  
will generate an interrupt. Higher voltages may be used  
provided a ser ies resistor is in line to the supply. Use  
the following formula to determine the series resistor  
needed.  
Rs = (Vi - 6) / .005  
Where: Vi = input voltage  
No series resistor is needed when Rs is negative.  
Page 12-1 RPC-320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
EXTERNAL INTERRUPT  
SECTION 12  
Figure 12-1 Optically isolated and TTL interrupts  
enable interrup ts.  
Page 12-2 RPC-320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
MULTI-MODE COUNTER  
SECTION 13  
Specifically, RPBASIC w rites a 2 to the MCR (M aster  
Control Register), reads the 3 counter bytes from the OL  
(Output latch), and converts it to the proper internal  
BASIC form at.  
DESCRIPTION  
The 24 bit multimode counter is capable of up/down,  
binary, divide-by-n, and quadrature inputs. C ount  
frequency is DC to 20 M hz. The R PC-320 uses an LSI  
Com puter Syste ms LS7166. Its data sheet is foun d in  
Appendix C.  
100 A = COUNT(0)  
COUNT statement writes a 24 bit number to the PR  
(Preset r egister) only. Its syntax is:  
The COU NT function and statement are used to read  
from and wr ite to the counter . L INEB is used to  
program the chip for various op erating mode s.  
200 COU NT 0, D  
To transfer this number to the counter, execute the  
following in the program:  
An interrupt, using ONITR, may be detected on a carry,  
borr ow, or either event. The event is jumper selectable  
through W8. When the counter is used, external  
interrupts (see Chapter 12) may not be used.  
LINEB 6,1,8  
The counter number is always 0 on the RPC -320.  
W8 P in  
1-2  
Description  
LINEB is used to access specific registers within the  
chip. Accessing control and status registers is shown  
below. C ounter bank is 6.  
External TTL level through P2-6 or  
optically isolated through P3  
Carry or borrow pulse from counter  
Carry pulse from counter  
3-4  
5-6  
7-8  
100 A = LINEB(6,1) : REM Read OSR  
200 LINEB6,1,X  
Borrow pulse from counter  
Line 200 writes to OCCR, ICR, QR, MCR, and ICR  
register s. W hich registe r selected is determ ined by bits  
6 and 7 in the byte written to the chip.  
Signals connect to the counter via P2. Use the following  
table to determine signal input to the LS7166.  
P2  
Name  
Function  
Program examples  
This code resets the counter and enables the inputs. The  
count is printed once a second. To see the count change,  
momentarily bring " A IN" or "B IN" on P2 to ground.  
When " B IN" is gr ounded, the count decrem ents.  
A IN  
B IN  
GND  
LOAD  
GATE  
Count input A  
Count input B  
Ground  
Load counter/latch (LCTR/LLTC)  
Gate/reset counter (ABGT/RCTR)  
10 LINEB6,1,32  
20 LINEB6,1,64+8  
30  
40  
ONTICK 1,500  
GOTO 40  
Input lines (A IN), (B IN), LOAD, and GATE are  
pulled to + 5V through a 10K resistor.  
500 PRINT COUNT(0)  
510 RETI  
PROGRAMMING  
Line 20 can be shortened somewhat. 64 selects the ICR  
(Input contr ol register ) and 8 enables inputs. 72 could  
have been used.  
The LS7166 is capable of several operating modes, all of  
which are not discussed here. See Appendix C for this  
chips operating modes. W hat are shown are exam ples of  
how to program this chip.  
NOTE: Be sure to initialize the counter chip before  
using COU NT com mands. Failure to do so  
returns m eaningless results.  
The COU NT function returns the current counter value.  
Page 13-1 RPC-320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
MULTI-MODE COUNTER  
SECTION 13  
The following program example returns a frequency.  
Input signal is at "A IN".  
COMMANDS  
The table below lists commands used with the counter.  
100  
110  
120  
130  
140  
500  
510  
520  
530  
530  
LINEB 6,1,32  
LINEB 6,1,72 : REM enable inputs  
ONTICK 1,500  
IDLE  
GOTO 130  
A=COUNT(0) : REM get count  
C=A-B : REM figure change from last time  
PRINT "Frequency = ",A  
B=A  
Comm and  
Function  
COU NT(0)  
COUNT 0,n  
Returns value in counter  
Writes value to counter  
RETI  
The fir st frequen cy read will always be a bit off. This is  
because of the time required to initialize ONTICK.  
Subsequent readings are more accurate.  
Accuracy is increased by stretching readings to every 10  
seconds. This is necessary w hen higher accura cy is  
needed.  
Other factors affecting accurate readings in this program  
include serial communications and ONITR statement. If  
ONITR is in process, ONTICK is delayed until ONITR  
is finished.  
The problem w ith this routine is periodically, a large  
negative number is returned. This is because the  
multimode counter has rolled over. This is corrected by  
periodica lly reseting the CNTR or transfer ring PR to  
CN TR. Refer to the data sheet, Appendix A for counter  
operating mo des.  
This program sets up the LS7166 to cause an interrupt  
when a pr eset numb er of cou nts is reached. W8[7-8] is  
jumpered to interrupt on a borrow.  
10  
20  
30  
40  
50  
LINEB 6,1,132  
COUNT 0,1000  
LINEB 6,1,8  
LINEB 6,1,72  
ONITR 500  
: REM write to CNTR  
: REM transfer PR to CNTR  
: REM enable A/B counters  
100 PRINT COUNT(0) : REM print progress  
110 GOTO 100  
500 PRINT "In Interrupt"  
510 RETI  
Line 10 sets OCCR to divide by N. Line 50 enables  
interrupts. Line 100 prints the counter. When pulses  
are applied to the A input, the count will go down. When  
1000 pulses are detected at A input, the message in line  
500 is printed.  
Page 13-2 RPC-320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
POWER MANAGEMENT  
SECTION 14  
grossly distorted.  
DESCRIPTION  
There are thr ee power mana gement modes. Each mode  
affects the way RPBASIC operates. T he IDLE  
command is used to control how the card operates  
NOTE: Delay printing out the R S-232 ports for at least  
20 ms (20 instructions) after exiting IDLE 1 or  
IDLE 2. These chips generate RS-232 voltages  
and require a "pow er up" time. Failure to do  
so could result in garbled ch aracters.  
Default mode is full power. All commands, timers, and  
interrupts function. IDLE command is not used.  
NOTE: The < Ctl> -C break char acter is not  
recognized in any of the IDLE modes.  
Norm ally this is not a problem except during  
progr am deve lopment. If the program is  
executing an IDLE statement and it won' t  
respond to any interrupts, pressing the reset  
button is the only w ay to exit.  
There are a number of ways to exit the IDLE mode in  
conjunction with ONITR. Refer to Chapter 12, External  
Interrupt and Chapter 13, Multi-mode Counter for ways  
to generate interr upts. IDLE 2 is restricted on the type  
of interrupt. T he signal at P2-INT must return to a high  
state befor e the next IDLE 2 command is executed. (P2-  
INT is also controlled by the multi-mode counter and  
optically isolated interrupt, described in Cha pter 12 and  
13.) If it does not go high, IDLE 2 mode w ill exit in  
approximately 3 ms. This is due to a characteristic of  
the A6 mask revision in the Dallas 80C320 CPU. A  
general rule is to keep the negative pulse at P2-INT  
greater than 50 ns but less than 3 ms.  
Exit IDLE 2 by applying a low going pulse at the INT  
input at P2. The pulse width should be 50 ns minimum.  
The other IDLE modes re quire a pulse width of at least  
1 micro-second. Optical interrupt ISOA/B may also be  
used to exit any of the IDLE modes. The pulse w idth  
needs to be at least 10 micr o-seconds.  
IDLE or IDLE 0 waits until an ONTICK or ONITR  
interrupt occur s. Serial I/ O oper ates norm ally. U se this  
comm and when you wan t your pr ogram to "hang out"  
until something happens. The RPC-320 operates under  
full power.  
FURTHER POWER REDUCTION  
Some applications require the least amount of power  
possible. You m ay rem ove cer tain IC' s from the card to  
do this. The table below lists the IC 'U' number,  
approximate curr ent consumption (in shutdown and run  
mode), and function.  
IDLE 1 reduce s power by 30% . H ere the C PU " shuts  
down" but the internal timers are still operating.  
ONT ICK and ON ITR will cause the card to come out of  
power down m ode. Howe ver, the RS-232 se rial por ts  
are disabled. C haracters in the transmitter buffer are not  
sent out and incoming characters are ignored.  
Un  
Curr ent  
Shutdown  
Function  
Run  
U9  
10 mA  
100 uA  
400 uA RS-485 interface  
IDLE 2 is the lowest power mode. T he CPU, internal  
timers, ser ial ports, and oscillator are tur ned off. Only  
interrupts responding to ONITR wake up the processor.  
Cur rent consumption is less than 5 ma with no signals  
going into or coming from the RPC -320.  
U14  
1.2 ma Reference for U 15,  
temperature reference.  
U15  
5 ma  
10 uA Analog to digital  
converter  
IDLE 2 also has a number of operating restr ictions.  
This mode shuts dow n the RS-232 rece iver/dr iver IC, so  
no character s can come in or go out. T his IC also  
supplies current for the amplifiers and analog to digital  
converter. Do not apply negative voltages to the analog  
input in this mode. The tick timer is shut off. However,  
the real tim e clock m odule, if installed, continues to  
operate.  
U11  
U17  
10 mA  
10 mA  
1 ua  
1 ua  
Digital I/O at J3  
Display output, keypad  
scanner.  
U8  
30 mA  
10 uA RS-232 driver/receiver,  
power supply for analog  
to digital converter,  
amplifiers  
NOTE: The RS-232 receiver is shut down in IDLE  
modes 1 and 2. A ny characters sent to the  
RPC-320 dur ing this time are ignored or  
Page 14-1 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
POWER MANAGEMENT  
SECTION 14  
Curr ents are maximum and minimum as specified by the  
manufacturer. Min-max curr ent ranges "guaranteed" by  
the device manufacturer have a tremendous range, often  
by a factor of 10 or m ore. Current abov e is “typical” .  
Some current consumption is difficult to determine.  
Digital outputs, for example, will draw virtually no  
current under no load conditions, but can supply 15 ma  
to each output if requir ed. Ther efore, inputs and outputs  
connected to the card will affect its current consumption.  
Some chips, such as U 9, will not draw m uch current  
unless there is activity on the R S-485 por t.  
Board current consumption may be affected by the  
setting of jump er W 7. T his jumper determ ines if inputs  
at J3 are pulled up or down. When set to pull up inputs,  
each line forced low increases current consumption by  
50 uA. If all inputs are tied to + 5V or ground,  
rem oving jump er W 7 may dr aw less cur rent.  
The application program IC in U6 may be changed to a  
29C040. This 512K byte memory draws 200 uA less  
current than a 32K byte one.  
Any contr ol line from P2 to gr ound dra ws 500 uA due to  
the 10K pull-ups. Lines at P6 are pulled to + 5V  
through a 10K resistor. Each low line draws 500 uA.  
The contrast adjustment (R18) can be removed or  
adjusted for minimum cur rent.  
Program Examp le  
This examp le makes the RP C-320 go into its lowest  
power mode.  
10 ONITR 500  
.
.
other code  
.
100 IDLE 2  
200 GOTO 100  
500 PRINT "In interrupt"  
510 RETI  
Page 14-2 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
TECHNICAL INFORMATION  
SECTION 15  
Opto isolated input ISOA/ISOB  
ELECTRICAL SPECIFICATIONS  
Isolated voltage s to 250 volts peak may be a pplied to this  
input. A series resistor is necessary for voltages above  
12V.  
CPU  
80C320, 22. 1184 Mhz clock  
Memory  
Keypad input  
RPBASIC-52, 32K RO M, jumperable for 64K.  
Type: 27C256 Access time: 80 ns or faster.  
10 lines accept a 16 position matrix keypad. Scanning  
and debounce performe d in RPBASIC-52.  
Program ming and data is 32K or 128K RAM standard,  
512K Optional.  
Display output  
14 digital and 6 power and ground lines used to control  
LCD , VF , and LC D graphics displays. D isplays  
supported in RPBASIC-52.  
RAM optionally battery backed up. Battery life is 5-10  
years depending upon RAM size, type, and oper ating  
temperature and time.  
Serial ports  
Two RS-232D serial ports. All have RxD , TxD , and  
CTS lines. COM 0 has only these lines. COM1 also has  
RTS. COM 1 configurable to RS-232 or RS-422/485.  
Term ination network for RS-422/485 available. Baud  
rates fr om 300 to 3 8.4 K are pr ogram mable. Length  
fixed at 8 bits, no parity, 1 start and stop bit.  
Maximum BASIC progra m is 62K  
Battery backed using D S1216DM , w hich also acts as a  
real time clock. Can also use DS1213C or D to battery  
back ram.  
Digital I/O  
EPROM and programmer  
The RPC -320 has 34 digital I/O lines. 24 are from J3,  
which is a ge neral pur pose por t.  
Accepts 29C 256, 29 C010, 29C040 or equivalent flash  
EPR OM from Atmel.  
Size: 32K (29C256), 128K(29C010), 512K(29C040)  
The specifications below a re for digital I/ O at P6 and J3  
except for the eight high current lines at J3.  
Calendar/Clock  
Optional DS-1216DM installed in socket U5.  
Accur acy to 1 minute/m onth  
Supported by RPBASIC  
Drive curr ent  
2.5 ma m aximum per line,  
sink or source. TTL  
compatible.  
Expected life 3 to 5 years depending upon RAM size  
installed, temperature, and operating time.  
Output low voltage 0.45V m ax at 2.5 mA , 1V  
max at 15 mA for opto rack.  
Output high v olts  
2.4V m inimum, sink or source  
at rated cu rren t.  
Watchdog timer, reset  
Watch dog timer resets C PU whe n enabled.  
Time between re sets is 380 ms or 2.8 seconds  
Push button reset. Exter nal reset through W10.  
All digital input lines are TTL compatible.  
High cu rrent output at J3  
Power requireme nts  
+ 5 ±5% at 95 ma operating.  
Current consumption is less than 5 ma in IDLE 2 mode,  
all components installed.  
8 of the 24 lines can drive up to 500 ma at 50V. Refer  
to CHAPTER 6, D IGITAL AND OPTO PORTS for  
limitations.  
Curr ent is less than 1 ma when analog and RS-485 chips  
(U14, 15,16, and 9) are removed.  
RS-232 voltages generated on card.  
Current consumption does not include any opto-modules  
or other acc essories.  
High current output at L8  
L8 sinks up to 2 amperes at 50 V olts. Sw itching is  
through a "zero" ohm FE T switch.  
Page 15-1 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  
TECHNICAL INFORMATION  
SECTION 15  
MEMORY AND I/O BANK MAP  
JUMPER DESCRIPTIONS  
Memory  
A * after a jumper position indicates fa ctory def ault is  
jumpered.  
Description  
RPBASIC-52, U4  
RAM , U 5, 32K  
128K  
Address  
0000H - 7FFFH  
00000H - 07FFFH  
00000H - 1FFFFH  
00000H - 7FFFFH  
Jumper  
Description  
W1[1-2]*  
W1[2-3]  
RAM size 32K, 128K  
RAM size 128K  
512K  
I/O Bank  
RAM (U5)  
EPRO M (U6)  
not used  
Digital I/O (U11)(J3)  
Display & keypad (U17)  
Control & L 0-L8 (U19)  
Counter (U13)  
not used  
0
1
2
3
4
5
6
7
W3[1-3],[2-4]  
W3[3-5],[2-4]  
W3[3-5],[4-6]  
29C040 F lash  
29C010 Flash  
29C256 F lash  
W2[1-3],[2-4]  
W2[3-5],[4-6]* Flash EPROM selected  
EPROM selected  
W4[1-2]  
W4[2-3]*  
COM 1 RS-485 input  
COM 1 RS-232 input  
MECHANICAL SPECIFICATIONS  
W5[1-2]*  
W6[1-2]*  
RS-485 terminator  
RS-485 terminator  
Size  
4.6" x 7.0"  
W7[1-2]*  
W7[2-3]  
J3 resistors pulled up  
J3 resistors pulled down  
4 mounting holes are 0.250 x 0.250 inches from each  
edge. Mounting holes are 0.124 inch in diameter.  
W8[1-2]  
W8[3-4]  
W8[5-6]  
W8[7-8]  
External or isolated interrupt  
Counter carr y or borrow interrupt  
Counter carr y interrupt  
Board thickness:  
Board m aterial:  
0.062  
FR-4  
Counter borr ow interrupt  
W9[1-2]*  
Do not autorun  
W9[no jumper] Autorun on reset  
W10[1-2] Exter nal reset inp ut.  
Page 15-2 RPC -320  
Download from Www.Somanuals.com. All Manuals Search And Download.  

Radio Shack Car Video System PLVWR84IR User Guide
RCA Cassette Player CDP18S711 User Guide
RSA Security Telephone 375 User Guide
Samson MP3 Player Accessories SR850 User Guide
Samsung Tablet SM T530NYKAX User Guide
Samsung Tablet SM T2105GYYXAR User Guide
Sanyo Microwave Oven em d754 User Guide
Schneider Electric Computer Hardware IP67 User Guide
Seagate Computer Drive 72009 User Guide
Seagate Computer Drive NASRaQ User Guide