Remote Technologies RPC-320 manual Reserved Memory, Storing Variables in RAM

Page 21

RAM MEMORY

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

When the combined program and data size exceed 30K, a 128K or 512K RA M is nec essary. Additional R AM is necessary when your pr ogram has large ar rays and / or string storage r equireme nts.

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 .

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 .

PEEK and PO KE commands store and retrieve values from memor y. For example:

20 POKEB1,12,A

puts the 8 bit value of A into segment 1, addr ess 12.

Use the PEEK statement to retrieve the variable:

50 B = PEEKB(1,12)

Accessing reser ved mem ory in a 32 K RAM system is accomplished as follow s:

SECTION 5

Figure 5-2 RPBASIC-52 memory map

100POKEB0,7E00H,C

120B = PEEKB(0,7E05H)

The highest address in a 32K RAM system is 7FFFH .

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

Word

Analog output offset

6

Floating

Corr ection factor

20

String

Job name

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 inc rem 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.

For this example, suppose there are 20 of these arrays that need to be set up. A program fragment is as follows:

100

STRING 400,20

Initialize 20 string arrays

300

NO =

12

Elem ent to fill

310

CF =

23.432

Corr ection factor

320 JC =

JC + 1

Job counter

330

AC =

25

Analog offset

350

GOSUB 1000

 

500 NO =

5

Element to retrieve

Page 5-2 RPC -320

Image 21
Contents REV TrademarksRevision Table of Contents External Reset Sect ION 11 Watchdog Timer DescriptionInterrupt Characteristics Sect ION 13 Multi Mode Counter DescriptionSoftware Revision History Section OverviewDescription Manual OrganizationTechnical Support Symbols and Term inologySystem layout Overview SectionOperating Precautions IntroductionEquipment Using a Terminal Using a PCFirst Time Operation Uploading and Downloading ProgramsEditing programs and program ming hints Troubleshooting Where to GO from HereSaving a Program Saving ProgramsEprom W3 autorun jumperPreventing Autorun AutorunningLoading a Program Changing Eprom SizeAlternate Eproms CommandsBload BsaveSerial Ports COM0 Serial PortCOM1 Serial Port Serial Ports Section RS-422/485 Operating InformationRS-422/485 Termination network Accessing Serial Buffers Two wire RS-485Multidrop Network Accessing COM0 and COM1 Disabling CONTROL-CSerial Port PIN OUT RXD CTS Checking the battery Battery BackupRAM Memory Changing MemoryStoring Variables in RAM Reserved MemoryBlock Data Transfer Assembly Language InterfaceDigital and Opto Ports Digital I/O PortsDigital Por t J3 Digital Port P6 Digital I/O CommandsHigh Current Port L8 Optically Isolated InputHigh Current Output Interfacing to switches and other devices Interfacing Digital I/O to an opto-module rackDigital I/ O prog ramm ing exam ple Ls e Width Modulation PWM Conne ctor pin ou t J3 Digital and Opto Ports SectionCount Config LineLine Line BSetting Date and Time DateM E Section Connecting Displays Writing to the DisplayProgramming Example Display Types Display Connector PIN OUTProgram explanation Keypad PortKeypad Port PIN OUT J5 Analog Input Connecting Analog InputsInitialization Overvoltage conditionsDifferential Mode Examples u sing CON FIG AINAcquiring Analog Data Noise Notes Temperature MeasurementAnalog Input Section Measuring Higher Voltages Data logging on a timer tickConverting Analog Measurements AmplifiersMeasuring 4-20 mA current loops Calibration External Reset Watchdog TimerInterrupt Characteristics Optically Isolated InterruptProgram Example Optically isolated and TTL interrup ts GND ProgrammingLoad GateCOU NT0 Further Power Reduction Power ManagementProgram Examp le Power Management SectionTechnical Information Electrical SpecificationsMemory and I/O Bank MAP Mechanical SpecificationsJumper Descriptions Bank