AH Motion Controller – Standard Instructions Manual _2 2.3.4 Using Devices, Symbols and Instructions A device is assigned to a symbol according to the data type of the symbol. You can set the initial value of the device. After the program in a project is downloaded to a motion controller, the initial values will be written into the devices assigned to the symbols at the first scan cycle. The principles of assigning devices to symbols are as follows. Users can assign devices to the global symbols and the local symbols declared in the program POU, or they can be assiagned automatically by the system.
Local symbols (except the symbols of VAR class) declared in a function block can only be assigned with devices by the system. The system will assign applicable devices only. (You can set a range of devices which can be assigned automatically.) If a symbol is declared, the device assigned to the symbol, the data type of the symbol, and the initial value of the symbol must be compatible with one another. The relation between the data types and the device types which can be assigned is described below. 2-12 Function Data type Name Description Program block BOOL Boolean A Boolean value represents the state of a contact, could be TRUE or FALSE. WORD Word Bit string of length 16.
DWORD Double Word Bit string of length 32. LWORD Long Word Bit string of length 64. UINT Unsigned integer 16-bit data. UDINT Unsigned double integer 32-bit data. INT Integer 16-bit data DINT Double integer 32-bit data. LINT Long Integer 64-bit data. REAL Real numbers 32-bit data; applicable to single precision floating-point instructions. LREAL Long reals 64-bit data; applicable to double precision floating-point instructions. CNT Counter 16-bit counter value or 32-bit counter value. TMR Timer 16-bit timer value. ARRAY Array If a symbol is declared as an array, the size of an array and an array data type must be specified.
(An array is composed of 256 elements/members at most.) String Character string Variable-length single-byte data string. 8 bits as one ASCII character. The string length needs to be specified on declaration.