<< Click to Display Table of Contents >> Manual > Server Creation Guide > Tag Edition > Function Explanation > Data types and conversions |
Data types and type conversion
Tags can be bit tags, numeric tags, string tags, or arrays of these. The final data type is determined by the "Type conversion settings".
■ Default tag type
If you set the type conversion to "Default Type", the final tag type will be determined by the "Type" on the "Address Settings" tab in the standard PLC, as shown below.
You can also make tags into an array by checking "Make an array" in the "Advanced Settings" tab.
type |
Default Type |
If tags are arrays |
bit |
Bit type |
Bit type array |
Integer BCD |
Numeric types |
Array of numeric types |
Integer BCD (signed) |
Numeric types |
Array of numeric types |
Integer Binary |
Numeric types |
Array of numeric types |
Integer Binary (signed) |
Numeric types |
Array of numeric types |
Single precision floating point type (IEEE) |
Numeric types |
Array of numeric types |
Double-precision floating-point type (IEEE) |
Numeric types |
Array of numeric types |
ASCII |
String types |
Array of strings |
*The above "When tags are made into an array" refers to when you make the tag an array tag by checking "Make an array" in the tag's advanced settings.
■ Filter
The default type of a tag may be converted by specifying a filter. For example, if you apply a "bit inversion" filter to a tag whose default type is numeric, the numeric tag will be converted to a bit type (0 is FALSE, non-zero is TRUE). If you want the converted value to remain numeric, specify the data type in the type conversion settings. For details on the filter function, see the "Filter" description in this manual.
■ Type conversion settings
Normally, leave it as the default. Specify type conversion only if you want to explicitly change the data type for some reason. For example, by specifying Boolean type for type conversion, you can convert a numeric tag to a bit type (0 is FALSE, non-zero is TRUE).
In particular, if you want to use "Refer to table file and convert to numeric or string" in the filter function to store comments or other strings in tags, specify the string type in the type conversion.
■OPC In OPC, the request type (type of data) is specified for each item (tag) from the client application (host side). If the request type is not specified (default), the value is passed in the final type of the tag (bits → VT_BOOL / numbers → VT_R8 / strings → VT_BSTR). If the request type specifies a type, the appropriate conversion is made according to the request and the value is passed to the higher-level side.
■InTouch When handling integers of seven or more digits with InTouch, be sure to set the filter "Use integers of seven or more digits with InTouch".
■Action Each action has internal processing that allows it to handle any final tag type. For example, if a tag type is a string but a numeric value is required, internal processing will be performed to interpret the string as a number. |