Define the Conversion Types for a Logic Program
You can use the Byte-String Conversions and String to Time Conversion Mode combo boxes to define how a Logic program converts values. The conversions that you select will affect the results of the program, so you need to choose the correct types of conversion for your needs.
To define the conversion types:
- Display the configuration Form for the relevant program (see Configure an ST Program, Ladder Diagram, SFC or FBD).
- Select the Logic tab.
- Use the Byte - String Conversions combo box to choose the conversion type for converting byte values into string values.
The available options include:
- Character—The system will use ASCII codes to convert the byte number into a string value. Each character has a a corresponding ASCII code—the program will read the byte value as an ASCII code.
- Decimal Integer—The system will use binary codes to convert the byte number into a string value. Each character has a corresponding binary code—the program will read the byte value as a binary code.
- Hexadecimal Integer—The system will use hexadecimal codes to convert the byte number into a string value. Each character has a corresponding hexadecimal value—the program will read the byte value as a hexadecimal value.
- Use the String to Time Conversion Mode combo box to define the format that will be used when the time inputs are converted to strings. The format can be:
- Windows—Uses a format that is similar to the date and time formats for the UK locale of Microsoft Windows. The format of the string is dependent on the type of input time value:
Input Type Output String Format (Windows) Date dd-MM-yyyy
For example, 09-12-2011Date and Time dd-MM-yyyy hh:mm:ss.SSS
For example, 09-12-2011 22:31:14.313Time of Day hh:mm:ss.SSS
For example, 22:31:14.313Time hh:mm:ss.SSS
For example, 22:31:14.313The milliseconds are omitted if they are zero.
If the time is negative, the string is prefixed with a minus sign, for example, minus 12 hours is: -12:00:00.
- IEC 61131-3—The IEC 61131-3 format is used to convert the input into a string output. The format of the string is dependent on the type of input time value:
Input Type Output String Format (IEC 61131-3) Date D#yyyy-MM-dd
For example, D#2011-12-03Date and Time DT#yyyy-MM-dd-hh:mm:ss.SSS
For example, DT#2011-12-03-13:43:24.341Time of Day TOD#hh:mm:ss.SSS
For example, TOD#22:31:14.313Time T#DdHhMmSsFms
Where D, H, M, S and F represent numerical values for day, hour, minute, second and milliseconds, respectively. For example:
T#16d21h19m25s13ms
Any element that is zero is omitted (unless all of the elements are 0, in which case the string is T#0). For example, one and a half hours is T#1h30m.
If the time is negative, a minus sign is added after the T#. For example, minus 30 minutes is: T#-30m.
- Windows—Uses a format that is similar to the date and time formats for the UK locale of Microsoft Windows. The format of the string is dependent on the type of input time value:
To configure the other Logic tab settings, see Configure an ST Program, Ladder Diagram, SFC or FBD.