Remote Technologies RPC-320 manual Editing programs and program ming hints

Page 10

SETUP AND OPERATION

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.

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.

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 tim e 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.

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.

Editing programs and program ming hints

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.

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 wr iting a progr am this w ay is

SECTION 2

increased download time.

Notice that you can w rite a progr am in lower case characters. RPBASIC-52 translates them to upper case.

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.

RPBASIC-52 autom atically formats a line for minimum code space. F or example, you could download the following line of code:

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:

10 for a =

0

to

5

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 .

Page 2-3 RPC-320

Image 10
Contents Trademarks REVRevision Table of Contents Interrupt Characteristics Sect ION 11 Watchdog Timer DescriptionExternal Reset Sect ION 13 Multi Mode Counter DescriptionSoftware Revision History Description OverviewSection Manual OrganizationSymbols and Term inology Technical SupportOverview Section System layoutIntroduction Operating PrecautionsEquipment First Time Operation Using a PCUsing a Terminal Uploading and Downloading ProgramsEditing programs and program ming hints Where to GO from Here TroubleshootingEprom Saving ProgramsSaving a Program W3 autorun jumperLoading a Program AutorunningPreventing Autorun Changing Eprom SizeBload CommandsAlternate Eproms BsaveCOM0 Serial Port Serial PortsCOM1 Serial Port RS-422/485 Operating Information Serial Ports SectionRS-422/485 Termination network Two wire RS-485 Accessing Serial BuffersMultidrop Network Disabling CONTROL-C Accessing COM0 and COM1Serial Port PIN OUT RXD CTS RAM Memory Battery BackupChecking the battery Changing MemoryReserved Memory Storing Variables in RAMAssembly Language Interface Block Data TransferDigital I/O Ports Digital and Opto PortsDigital Por t J3 High Current Port L8 Digital I/O CommandsDigital Port P6 Optically Isolated InputHigh Current Output Interfacing Digital I/O to an opto-module rack Interfacing to switches and other devicesDigital I/ O prog ramm ing exam ple Ls e Width Modulation PWM Digital and Opto Ports Section Conne ctor pin ou t J3Line Config LineCount Line BDate Setting Date and TimeM E Section Writing to the Display Connecting DisplaysProgramming Example Display Connector PIN OUT Display TypesKeypad Port Program explanationKeypad Port PIN OUT J5 Initialization Connecting Analog InputsAnalog Input Overvoltage conditionsExamples u sing CON FIG AIN Differential ModeAcquiring Analog Data Temperature Measurement Noise NotesAnalog Input Section Data logging on a timer tick Measuring Higher VoltagesAmplifiers Converting Analog MeasurementsMeasuring 4-20 mA current loops Calibration Watchdog Timer External ResetOptically Isolated Interrupt Interrupt CharacteristicsProgram Example Optically isolated and TTL interrup ts Load ProgrammingGND GateCOU NT0 Power Management Further Power ReductionPower Management Section Program Examp leElectrical Specifications Technical InformationJumper Descriptions Mechanical SpecificationsMemory and I/O Bank MAP Bank