Chapter 3. Program Data
GFK-2950C
February 2018
37
3.2
Reference Memory
The CPU stores program data in bit memory and word memory. Both types of memory are divided
into different types with specific characteristics. By convention, each type is normally used for a
specific type of data, as explained below. However, there is great flexibility in actual memory
assignment.
Memory locations are indexed using alphanumeric identifiers called references. The reference’s
letter prefix identifies the memory area. The numerical value is the offset within that memory area,
for example %AQ0056.
3.2.1
Word (Register) References
Type Description
%AI
The prefix %AI represents an analog input register. An analog input register holds the value of one
analog input or other non-discrete value.
%AQ
The prefix %AQ represents an analog output register. An analog output register holds the value of
one analog output or other non-discrete value.
%R
Use the prefix %R to assign system register references that will store program data such as the
results of calculations.
%W
Retentive Bulk Memory Area, which is referenced as %W (WORD memory).
%P
Use the prefix %P to assign program register references that will store program data with the _MAIN
block. This data can be accessed from all program blocks. The size of the %P data block is based on
the highest %P reference in all blocks. %P addresses are available only to the LD program they are
used in, including C blocks called from LD blocks; they are not system-wide.
Note:
All register references are retained across a power cycle to the CPU.
Indirect References
An indirect reference allows you to treat the contents of a variable assigned to an LD instruction
operand as a pointer to other data, rather than as actual data. Indirect references are used only with
word memory areas (%R, %W, %AI, %AQ, %P, and %L). An indirect reference in %W requires two %W
locations as a DWORD indirect index value. For example, @%W0001 would use the %W2:W1 as a
DWORD index into the %W memory range. The DWORD index is required because the %W size is
greater than 65K.
Indirect references cannot be used with symbolic variables.
To assign an indirect reference, type the @ character followed by a valid reference address or
variable name. For example, if %R00101 contains the value 1000, @R00101 instructs the CPU to use
the data location of %R01000.
Indirect references can be useful when you want to perform the same operation to many word
registers. Use of indirect references can also be used to avoid repetitious logic within the application
program. They can be used in loop situations where each register is incremented by a constant or by
a value specified until a maximum is reached.
Bit in Word References
Bit in word referencing allows you to specify individual bits in a word reference type as inputs and
outputs of Boolean expressions, functions, and calls that accept bit parameters (such as
parameterized blocks). This feature is restricted to word references in retentive memory. The bit
number in the bit within word construct must be a constant.
You can use the programmer or an HMI to set an individual bit on or off within a word, or monitor a
bit within a word. Also, C blocks can read, modify, and write a bit within a word.
Summary of Contents for PACSystems RSTi-EP
Page 357: ......
Page 466: ...Chapter 9 Diagnostics GFK 2950C February 2018 451 ...