Go to Parker.com
  • Sign in
Technologies
  • Aerospace
  • Climate Control
  • Electromechanical Group
  • Filtration
  • Fluid and Gas Handling
  • Hydraulics
  • IoT
  • Pneumatics
  • Process Control
  • Sealing and Shielding
Blogs Forums Knowledge Bases
Parker Community
Parker Community
  • Technologies
    • Aerospace
    • Climate Control
    • Electromechanical Group
    • Filtration
    • Fluid and Gas Handling
    • Hydraulics
    • IoT
    • Pneumatics
    • Process Control
    • Sealing and Shielding
    Blogs Forums Knowledge Bases
  • User
  • Site
  • Search
  • User
Home Technologies Electromechanical Group Electromechanical - Industrial Electromechanical Industrial Knowledge Base How to use Direct Variable references in ACR IEC PLC
Electromechanical - Industrial
  • Technologies
  • Electromechanical Group
  • Electromechanical - Industrial
  • More
  • Cancel
Electromechanical - Industrial
Electromechanical Industrial Knowledge Base How to use Direct Variable references in ACR IEC PLC
  • Electromechanical – Industrial Support Forum
  • Electromechanical Industrial Knowledge Base
  • Members
  • Sub Groups
  • More
  • Cancel
  • New
Electromechanical - Industrial requires membership for participation - click to join
  • Electromechanical Knowledge Base & Frequently Asked Questions
  • Motion and Machine Controllers-
    • ACR Controllers-
      • 7000+
      • ACROBasic Programming (IPA/7000/9000)+
      • 9000 (Legacy)+
      • IEC PLC (9600) (Legacy)-
        • Acrobasic commands for IEC PLC
        • ACRView 6.4.1 Runtime Error for 9600 and 9640
        • ACRView IEC Editor not Compatible with Win10
        • Converting ACR9600 Projects to ACR9000 Projects
        • General Function Block Behavior
        • How to add multiple outputs in ACR IEC PLC ladder programs
        • How to change the Task Type or Task Speed
        • How to change velocity on the fly
        • How to home to a limit in ACR96xx
        • How to Modify a ACR-View project (9600) AcroBasic only programs for Win10
        • How to run an AcroBasic program from IEC PLC
        • How to start the IEC PLC on controller power-up
        • How to use Direct Variable references in ACR IEC PLC
        • IEC Error Message: No valid license for the current hardware
        • Invert Motion Direction in IEC PLC
        • Is there a First Scan flag in the IEC PLC
        • PLCOpen State Machine
        • Set Compax3-EPL Current Limit
        • User Function Block : Excess Position Error Response
        • User Function Block : Moving Average
        • User Function Block : Rotary Axis Position
        • User Function Block: Read Actual Torque
        • User Function Block: Software Limits
        • Using arrays in IEC PLC
        • Using the IEC Debug Window and Watch Lists
        • Variable Declarations in IEC Languages
        • VIDEO: How to import function blocks into ACR IEC_PLC projects
        • What is a Moving Segment Error?
        • Why is the IEC PLC making the axis to move farther and faster than programmed?
      • PC Card Controllers (Discontinued)+
    • PAC120+
    • PAC340+
    • PAC320 (Discontinued)+
    • 6K (Discontinued)+
  • General Technology Information+
  • Virtual Engineer+
  • Visualization and Human Machine Interface (HMI)+
  • Servo Drives and Servo Drive/Controllers+
  • Stepper Drives and Stepper Drive/Controller+
  • AC/DC Industrial Drives+
  • Gearheads+
  • Servo Motors+
  • Step Motors+
  • Linear and Rotary Positioners+
  • Electric Cylinders+
  • T-Slot Aluminum Framing+
  • C3 + Xpress + ETH+
  • How can I stay updated on Parker electromechanical and drives product news?
  • Legacy (Discontinued)+
  • Other+
  • Memorandum: Information on EPA ban of Persistent bioaccumulative toxin (PBT)
Wiki Actions
  • Share
  • More
  • Cancel
Community Quick Links
  • Home
  • Technologies
    • Aerospace
      • Supplier Resource Center
    • Climate Control
    • Electromechanical Group
      • Electromechanical - Industrial
      • Electromechanical – Mobile
    • Filtration
    • Fluid and Gas Handling
    • Hydraulics
    • IoT
      • Mobile IoT
    • Pneumatics
      • Pneumatic Industrial
      • Pneumatics Mobile
    • Process Control
    • Sealing and Shielding
  • Community Blogs
  • Community Forums
  • Community Knowledge Bases
Follow Us
  • Follow Parker Hannifin on social media

Follow Parker Hannifin on social media:

How to use Direct Variable references in ACR IEC PLC

Print Friendly and PDF

Products: ACR9600, 9630, 9640


Available ACR User Variables 
Process Image 
Global Declarations
Using Write Variables: PW and BW 
Using Direct Variables with HMI or Acrobasic
Restricted Flags

IEC61131-3 requires all data objects to be declared as variables. A set of different declaration sections is available to define variables on different scopes. IEC61131-3 comes with a set of predefined data-types, called elementary data types. And, there are some means to define user-defined, so called derived data types, using structures, arrays and enumerations.

With most variables, storage is assigned by the compiler, without any programmer activity. For inputs, outputs, and other ACR specific bits and parameters, the programmer may specify a memory location, using directly represented variables.

Directly represented variables are those variables that are mapped to a certain input, output or memory address specified by the programmer. The keyword AT is used to declare this, and the address is specified in a string starting with a percent sign (%).

 


Direct variables supported in ACR controllers:

-AT%Bnnn read-only flag, where nnn is the bit number
-AT%BWnnn read/write flag, where nnn is the bit number
-AT%Pnnn read-only parameter, where nnn is the parameter number
-AT%PWnnn read/write parameter, where nnn is the parameter number



Notes:

  • Direct variables must be designated BW or PW (read/write) in order for them to be written back out to the controller at the end of a PLC scan.
  • Certain ACR flags/bits cannot be assigned as BW. See Restricted Flags below.
  • While only certain bits are restricted, it is recommend that only ACR bits and parameters designated as physical outputs or user variables be assigned a PW or BW.
  • Direct Variables cannot take a initial value nor be marked as RETAIN
  • Only the following IEC data types can be associated with Direct Variables. Any other data type will result in a compiler error.
    • INT, SINT,INT,DINT,USINT,UINT,UDINT
    • BOOL,BYTE,WORD,DWORD
    • REAL
    • ACR LONG variables can be represented as any INT (SINT,INT,DINT,USINT,UINT,UDINT) or WORD(BOOL,BYTE,WORD,DWORD) Data type
    • ACR Float (32 and 64 bit) variables can be represented as REAL in the IEC PLC
  • Direct Variables can be declared in Programs and Direct Global files but not in Function Blocks or Functions

 

Examples of direct variables

fVar0 : REAL AT%P0;

fVar1 : REAL AT%P1;

fVar2 : REAL AT%P2;

fVar3 : REAL AT%P39168;

fVar4 : REAL AT%P39423;

In128 : BOOL AT%B128;

In129 : BOOL AT%B129;

Int0 : SINT AT%P38912;

Int1 : INT AT%P38913;

Int2 : DINT AT%P38914;

Int3 : USINT AT%P38915;

Int4 : UINT AT%P38916;

Int5 : UDINT AT%P38917;

Int6 : BOOL AT%P38918;

Int7 : BYTE AT%P38919;

Int8 : WORD AT%P38920;

Int9 : DWORD AT%P38921;

Init : BOOL AT%B128;

OnBit : BOOL AT%B129;

OffBit : BOOL AT%B130;

Input31 : BOOL AT%B31;(* comment for Input31*)

Output32 : BOOL AT%BW32;(* comment for Output32*)

 

Available ACR User Variables

.

Parameter Range ACR Data type IEC Data Type Retained Notes
P0-P4095 64-Bit float REAL BBRAM or Flash Must be dimensioned prior to use. Dimensioning included in ACR-View Configuration Wizard
P4100-P4103 32-Bit Long DINT, DWORD No Each parameter contains 32 user flags (BIT128-255)
P4156-P4159 32-Bit Long DINT, DWORD No Each parameter contains 32 user flags (BIT1920-2047)
P38912-P39167 32-Bit Long DINT, DWORD BBRAM  
P39168-P39423 32-Bit float REAL BBRAM  
BIT128-255 Bit BOOL No Also accessible as P4100-P4103
BIT1920-2047 Bit BOOL No Also accessible as P4156-P4159

 

 

Process Image

Direct variables are READ from controller registers prior to a program scan. The values are then placed in the Process Image. The program then uses the values from the process image during the scan. When the program is complete the values of the PW and BW variables are written backed to the controller registers.

For example, a program contains these variables:

Input31 : BOOL AT%B31;(* comment for Input31*)

Output32 : BOOL AT%BW32;(* comment for Output32*)

 

The value of Input31 is read at the beginning and that value is used throughout the program scan, regardless of whether the Input changes during the scan. And the value for Output32 is only written when the program is complete: it does not matter if Output 32 is changed mulitple times within the program, only the last value is actually written to the hardware output.

 

Global Declarations

Direct variables are allowed in Global declarations files, making the variables accessible in ALL programs. At the beginning of EACH program, the variables will be read from hardware and then written back to hardware at the end of EACH program. This means that the combination of many programs and many Direct Global variables will negatively impact overall scan time. Direct Globals should be limited to those variables that must be accessed by multiple programs.

Also keep in mind that when variables are declared as PW and BW, each program will try to write that value as part of the process image, regardless of whether it really uses the variables. Global PW and BW variables should be used sparingly and cautiously to avoid undesired behavior.

 

Using Write Variables: PW and BW

Direct variables designated as PW and BW are written by the PLC to controller registers. The editor and runtime engine allows most ACR bits and parameters to be written, but the user should be very selective. In general, only ACR bits and parameters designated as User Variables or as digital or analog outputs should be marked as write variables.

If a program needs to modify system bits or parameters, consider using function blocks designed for this purpose: ACR_ReadDintParameter, ACR_ReadRealParameter, ACR_ReadFlag, ACR_WriteDintParameter, ACR_WriteRealParameter, ACR_WriteFlag This will help avoid potential conflicts and save processing time for variables that only need to be written infrequently.

Using Direct Variables with HMI or Acrobasic

Direct variables can be used to exchange data with an HMI or Acrobasic program. If the value is to be written FROM the HMI to the PLC, then the variable should be designated as AT%B or AT%P rather than PW or BW. Because BW and PW vars are written every scan, it is likely that the value from the HMI will be overwritten before the PLC ever sees the change.

Example

BitToHMI : BOOL AT%BW128;

BitFromHMI : BOOL AT%B129;

ParmToHMI : BOOL AT%PW100;

ParmFromHMI : BOOL AT%P100;

 

In the case where both a program and the HMI need to modify a variable, again use the AT%B or AT%P designators and then in the PLC program use a FB to modify the value in the program: ACR_WriteDintParameter, ACR_WriteRealParameter, ACR_WriteFlag

 

 Restricted Flags

The following flags CANNOT BE ASSIGNED AS AT%BW (read/write), a Moving Segment Error will result.

 

 

 

 

 

 

 

 

 

 

These bits can still get set thru the PLC, use MC_WriteBoolParameter or ACR_WriteFlag

 

Bit Range

Desc

ErrorID

768

1023

Primary Axis Flags (Axes 0-7)

3

7680

7935

Primary Axis Flags (Axes 8-15)

3

512

767

Primary Master Flags (Masters 0-7)

3

40

47

Drive Enable Outputs

2

48

55

Drive Reset Outputs

2

56

63

LEDs

2

64

71

Drive Fault Inputs

2

96

103

LEDs

2

112

115

Trigger captures

3

  • Share
  • History
  • More
  • Cancel
  • Sign in to reply
Related
Follow Us
  • Follow Parker Hannifin on social media

Follow Parker Hannifin on social media:

Parker Hannifin Parker Hannifin

  • Products
  • About Parker
  • Investors
  • Community
  • Careers

Global Operations Global Operations

  • Divisions
  • Sales Companies
  • Worldwide Locations
  • Distribution Network
  • ParkerStore™ Network

Company Information Company Information

  • Newsroom
  • Event Calendar
  • Working with Parker
  • Product Brands
  • History

Global Support Center Global Support Center

  • Support
  • CAD
  • Where to Buy
  • Contact Parker
  • Manage Online Orders
© Parker Hannifin Corp 2023
  • Site Map
  • Safety
  • Privacy Policies
  • Terms and Conditions
  • Community Terms of Use
ENGINEERING YOUR SUCCESS.