Kamis, 29 Januari 2009

Variable Programming from GE Fanuc


What is Variable Programming?
In Control, a variable must be created for every contact or coil reference and for every function block parameter. In variable programming, a variable is defined to communicate information about the data it represents:
· Name: The name you assign to the variable. Defines the physical location of the variable. The address can be set in one of three ways:
· The address may be set to a reference address, referencing PLC data types supported by the PLC.
· The address may be left blank, allowing the software to locate the variable when the program is compiled.
· The address may contain the name of an existing variable. For example, if you want a new variable, Pump_1, to use the same address as an existing variable, Main_Pump, – set the address field to Main_Pump.
Note: If the variable name you want to reference is an array, you must provide a subscript for the variable. For example, Warehouse_Data[1] will locate the new variable at address of the first location for Warehouse_Data.
· Type: Defines the data type for the variable. Common data types include BOOL, BYTE, WORD, INT, DWORD, DINT, REAL, UINT. All variables must have a type defined. The data type determines how the variable is used in the program: as a discrete reference, as a signed or unsigned integer, etc.
· Len: Specifies the length of the variable. The length is defined in units based on the data type. For example, a Boolean variable (Type BOOL) with length of 8 causes the program to allocate 8 bits for the variable, whereas a double-precision integer variable (Type DWORD) with a length of 8 causes the program to allocate 256 bits for the variable (eight 32-bit integer values). 4· Address: Defines the physical location of the variable. The address can be set in one of three ways:
· The address may be set to a reference address, referencing PLC data types supported by the PLC.
· The address may be left blank, allowing the software to locate the variable when the program is compiled. (This is the Auto Variable Locate feature.)
· The address may contain the name of an existing variable. For example, if you want a new variable, Pump_1, to use the same address as an existing variable, Main_Pump, – set the address field to Main_Pump.
Note: If the variable name you want to reference is an array, you must provide a subscript for the variable. For example, Warehouse_Data[1] will locate the new variable at address of the first location for Warehouse_Data.
· Scope: Specifies the level in the programming hierarchy where the variable is defined. There are three scopes for variables: Configuration, Program, or Local. Variables can be defined as you enter program logic or can be defined before you begin writing your program. Other optional fields can be completed to further express how the variable is used by the program.

Tidak ada komentar: