Chapter 3. Program DataGFK-2950C February 2018 373.2 Reference MemoryThe CPU stores program data in bit memory and word memory. Both types of memory are dividedinto different types with specific characteristics. By convention, each type is normally used for aspecific type of data, as explained below. However, there is great flexibility in actual memoryassignment.Memory locations are indexed using alphanumeric identifiers called references. The reference’sletter prefix identifies the memory area. The numerical value is the offset within that memory area,for example %AQ0056.3.2.1 Word (Register) ReferencesType Description%AI The prefix %AI represents an analog input register. An analog input register holds the value of oneanalog input or other non-discrete value.%AQ The prefix %AQ represents an analog output register. An analog output register holds the value ofone analog output or other non-discrete value.%R Use the prefix %R to assign system register references that will store program data such as theresults 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 _MAINblock. This data can be accessed from all program blocks. The size of the %P data block is based onthe highest %P reference in all blocks. %P addresses are available only to the LD program they areused 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 ReferencesAn indirect reference allows you to treat the contents of a variable assigned to an LD instructionoperand as a pointer to other data, rather than as actual data. Indirect references are used only withword memory areas (%R, %W, %AI, %AQ, %P, and %L). An indirect reference in %W requires two %Wlocations as a DWORD indirect index value. For example, @%W0001 would use the %W2:W1 as aDWORD index into the %W memory range. The DWORD index is required because the %W size isgreater than 65K.Indirect references cannot be used with symbolic variables.To assign an indirect reference, type the @ character followed by a valid reference address orvariable name. For example, if %R00101 contains the value 1000, @R00101 instructs the CPU to usethe data location of %R01000.Indirect references can be useful when you want to perform the same operation to many wordregisters. Use of indirect references can also be used to avoid repetitious logic within the applicationprogram. They can be used in loop situations where each register is incremented by a constant or bya value specified until a maximum is reached.Bit in Word ReferencesBit in word referencing allows you to specify individual bits in a word reference type as inputs andoutputs of Boolean expressions, functions, and calls that accept bit parameters (such asparameterized blocks). This feature is restricted to word references in retentive memory. The bitnumber 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 abit within a word. Also, C blocks can read, modify, and write a bit within a word.