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 con tents of this ma nual and the sp ecifications her ein may change without notice. TRADEMARKS RPBASIC-52™ Corpor ation. PC SmartLINK® Corpor ation. is a trademark of Remote P rocessing is a trademark of Octagon Systems BASIC-52© is a trademark of Intel Corpor ation.
TABLE OF CONTENTS SECTION 1 OVERVIEW DESCRIPTION . . . . . . . . . . MANUAL ORGANIZATION . MANUAL CONVENTIONS . . Symbols and Term inology TECHNICA L SUPPORT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . SECTION 2 SETUP AND OPERATION INTRODUCTION . . . . . . . . . . . . . . . . . OPERATING PRECAUTIONS . . . . . . . . . EQUIPMENT . . . . . . . . . . . . . . . . . . . . FIRST TIME OPERATION . . . . . . . . . . . Using a PC . . . . . . . . . . . . .
TABLE OF CONTENTS SECT ION 11 WATCHDOG TIMER DESCRIPTION . . . . . . . . . . . . . . . . EXTERNAL RESET . . . . . . . . . . . . . DESCRIPTION . . . . . . . . . . . . . . . . OPTICALLY ISOLATED INTERRUPT INTERRUPT CHARACTERISTICS . . . . . . . . . . . . . . . . . . 11-1 11-1 11-1 11-1 11-1 SECT ION 12 EXTERNAL INTERRUPT DESCRIPTION . . . . . . . . . . . . . . . . PROGRAMMING . . . . . . . . . . . . . . Program exam ples . . . . . . . . . . . COMMANDS . . . . . . . . . . . . . . . . . . . . . . . . .
SOFTWARE REVISION HISTORY V1.04 Release for RPC 320 V1.05 BSAVE retur ned a hardware er ror when ver ify was bad. In fact, save was OK. V1.06 LCD graphics hardware CS and reset are reversed. C ompensated in software. V1.07 MTO P was useless in any system, especially a 3 2K RA M . V1.08 Varia bles E and F wo uld get dro pped if followed by a space. Added de lays betwee n data strob e writes to LCD display. V1.09 STR(7, . . .
OVERVIEW SECTION 1 DESCRIPTION from your PC are downloaded using a serial communication program. The RP C-320 is a n embed ded contr oller with a built in Basic language. Several featur es make it suitable as a stand alone un it: MANUAL ORGANIZATION 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. High speed multimode counter accepts quadrature or single inputs.
OVERVIEW SECTION 1 TECHNICAL SUPPORT Symbols and Term inology 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. WARNING: Information under this heading warns you of situations which might cause catastrophic or irreversible damage. W[-] If you have a question about the RPC-320 or RPBASIC52 and can' t find it in this manual, call us and ask for technical supp ort.
OVERVIEW SECTION 1 Figure 1-1 System layout Page 1-3 RPC -320
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. Requirements for uploading and downloading programs are discu ssed.
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. RPC -320 jump ers have been set at the fa ctory to op erate 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. 1. RPBASIC-52 V1.
SETUP AND OPERATION SECTION 2 increased download time. sending it char acters. The uploa d and dow nload file does not conta in any special c odes; th ey 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.
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.
SAVING PROGRAMS SECTION 3 INTRODUCTION 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.
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 su re the star t up progr am w as saved to segment 0. 2. Remove jumper W9.
SAVING PROGRAMS 29C040 512K SECTION 3 COMMANDS [1-3], [2-4] 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.
SERIAL PORTS SECTION 4 DESCRIPTION COM0 SERIAL PORT 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 th em. 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.
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. 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. RS485 mode turns on the transmitter only when sending.
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.
SERIAL PORTS SECTION 4 You can access C OM0 and COM 1 buffers in three w ays: 1. INP UT sta tement. This re moves a ll charac ters in the buffer up to the term inator cha racter and puts them into a variable. When using the INPUT statement, program execution is susp ended until a < cr> (Enter key) is received. W hether this is a problem depends on your particular application. INPUT strips bit 7. This means ASCII characters from 0 to 127 are rec eived. 2. GET function.
SERIAL PORTS 5 6 9 10 RXD CTS Ground + 5 SECTION 4 In Out *RTS input not in COM0. A seria l cable is ma de by simp ly taking a 10 pin fe male IDC connector and crim ping a 9 wir e ribbon c able to it.
RAM MEMORY SECTION 5 INTRODUCTION To install a new memory chip: 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. 1. Turn off power to the RPC-320. 2. Remove the mem ory chip from U 5. 3. Orient the chip so pin 1 is towards the inside. 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.
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 upp er 512 by tes of mem ory ar e set aside for this purpose in a 32K RAM system.
RAM MEMORY 510 GOSUB 2000 SECTION 5 Retrieve variables This subroutine stores variables CF, JC, and AC into an array starting in segment 1, address 0. 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 INTERFACE Assembly language program s must be placed in the RPBASIC-52 E PROM . W hen using RPBASIC-52, progr ams shou ld start at addr ess 6000H or higher up to 7FFFH.
DIGITAL AND OPTO PORTS SECTION 6 INTRODUCTION Digital I/ O lines ar e used to inter face with op to-module racks, switches, low current LED's, and other TTL devi ce s. T h e RPC -32 0 has 3 4 o f 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. Eight lines at P6 are intended for general purpose TTL I/O such as switches, level sensors or to drive other devices.
DIGITAL AND OPTO PORTS SECTION 6 ground through a 10K/100K resistor packs using jumper W7. 10K is on digital port A only. Jumper W7 for pull up or down configuration is as follows: W7[1-2] W7[2-3] to the touch. Consider the maxim um ambient temper ature the b oard w ill operate a t. A t 70°C, warm to the touch at room temperature m ay be too much. Consider adding a heat sink. 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.
DIGITAL AND OPTO PORTS SECTION 6 digital I/O lines 8 bits at a time . T he addr ess for po rt 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. 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. LINE # function and statement accesses lines according to the pin number at J3. J3 lines are number ed from 101 to 125.
DIGITAL AND OPTO PORTS SECTION 6 130 Protection diodes m ust be used with inductive loads. Refer to figure 6-2 A = LINE#(103) Function 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.
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 o utput. Note that the LINE statement is us ed to contr ol both opto modules and individual lines. Lines can also be re ad or co ntrolled in the imme diate mode. PRINT LINE#(125) returns the status at J3-25.
DIGITAL AND OPTO PORTS SECTION 6 Table 6-1 Conne ctor pin ou t - J3 Pin # 82C55 19 21 23 25 24 22 20 18 Port Port Port Port Port Port Port Port A, A, A, A, A, A, A, A, line line line line line line line line 0 1 2 3 4 5 6 7 10 8 4 6 1 3 5 7 Port Port Port Port Port Port Port Port B, B, B, B, B, B, B, B, line line line line line line line line 0 1 2 3 4 5 6 7 High High High High High High High High 13 16 15 17 14 11 12 9 Port Port Port Port Port Port Port Port C, C, C, C, C, C, C, C, line l
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 Configu res I/ O por ts COUNT Returns number of pulses at a line. LINE Function retur ns status of an opto module as a 0 or 1. LINE Statemen t turns on or off an opto module. LINE B Function returns 8 data bits from any I/O type device. LINE B S tatemen t w rites 8 d ata b its to any I/O type device.
CALENDAR/CLOCK SECTION 7 DESCRIPTION An optional DS1216DM calendar/clock module m ay be installed in U5. The DS1216D M also battery backs RAM. NOTE: The clock module is turned off as shipped from the factory. DATE and TIME functions return a HA RDW ARE erro r until DA TE is se t first. To retrieve date and time as part of a program: 100 110 120 130 140 150 160 170 180 190 The DS1216DM from Remote Processing is a modified version of the Dallas DS1216D. An internal reset line has been cut.
CALENDAR/CLOCK SECTION 7 Figure 7-1 Calendar/Clock Page 7-2 RPC-320
DISPLAY PORT SECTION 8 INTRODUCTION RPBASIC-52 and the RP C-320 interface to a variety of displays: VF (vacuum florescent) character LCD (liquid crystal) character LCD gr aphics 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 a djustment fo r LC D char acter disp lays is built into the card.
DISPLAY PORT SECTION 8 DISPLAY TYPES RPBASIC-52' s software driver is based upon the characteristics of the display family. Compatible VF and LCD displays are shown below: Manu fact. Model Type Optrex Optrex IEEE Optrex DMC 40457 DMC 40202 3601-90-080 DMF 682N LCD LCD VF 4 LCD COMMANDS The following RPBASIC-52 com mands are used for the display. Comm and 4 x 40 2 x 40 x 20 160W x 128D DISPLAY CONNECTOR PIN OUT The displa y port uses an 82C5 5 for data and contr ol.
KEYPAD PORT SECTION 9 INTRODUCTION 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 whe n a row and a colum n connect. RPBASIC-52 scans and debounces the keypad every 50 ms. Keypad pr esses are retur ned as a num ber fr om 1 to 24 using the KE YPA D function . Ke ypad scann ing is always active and cannot be turned off. Up to 8 key presses are buffered. Keypad presses are multi-tasked using ON KEYPAD.
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 configu red 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 Line 10 sets up the tasker for keypad interrupts to start at line 1000.
ANALOG INPUT SECTION 10 usually affects readings on other channels. DESCRIPTION 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. Reference IC U 14 has a voltage output that corresponds to the IC tem peratur e.
ANALOG INPUT SECTION 10 Per form a conver sion as nor mal: following tables for differ ential inputs. A = AIN(0) When channel = odd Pol. CH # 0 channel + 1 2 1 + 3 4 3 + 5 6 5 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: + 7 7 A = AIN(1) When channel = even Pol. CH # + 0 1 + 2 3 + 4 5 + 6 7 Single-ended, ±2.
ANALOG INPUT SECTION 10 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, b ut requir es a longer time to get a data point. period of time (several seconds if possible). 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.
ANALOG INPUT SECTION 10 The outpu t from the tempe ratur e sensor v aries fr om unit to unit. Self heating effects as well as supply voltage will change the output.
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 O NTI CK 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.
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=.
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 ca librated for a 0 to 5V inpu t. This range is chan ged by adjusting R17. You can adjust the range to 5.12V.
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.
EXTERNAL INTERRUPT SECTION 12 DESCRIPTION INTERRUPT CHARACTERISTICS There are tw o sources of interrupts the ONITR statement respond s to: Inter nal and exter nal. Exter nal interr upts are off-card. Internal interrupts are from the counter. 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.
EXTERNAL INTERRUPT SECTION 12 Figure 12-1 Optically isolated and TTL interrup ts enable interrup ts.
MULTI-MODE COUNTER SECTION 13 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 LS 7166. Its data sheet is foun d in Appendix C. The COU NT function and statement are used to read from and wr ite to the counter . L INE B is used to program the chip for various op erating mode s. An interrupt, using ONITR, may be detected on a carry, borr ow, or either event.
MULTI-MODE COUNTER SECTION 13 The following program example returns a frequency. Inp u t sig n al is at " A IN " . COMMANDS The table below lists commands used with the counter.
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 Default mode is full power. All commands, timers, and interrupts function. IDLE command is not used. 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.
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. Cur rent abov e is “ty pical” . 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 outpu t if requir ed.
TECHNICAL INFORMATION SECTION 15 ELECTRICAL SPECIFICATIONS Opto isolated input ISOA/ISOB CPU 80C320, 22. 1184 Mhz clock Isolated voltage s to 250 volts peak may be a pplied to this input. A series resistor is necessary for voltages above 12V. Memory RPBASIC-52, 32K RO M, jumperable for 64K. Type: 27C256 Access time: 80 ns or faster. Keypad input 10 lines accept a 16 position matrix keypad. Scanning and debounce performe d in RPBASIC-52.
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.