DINT to String-DTOS
This information applies to the CompactLogix 5370, ControlLogix 5570, Compact GuardLogix 5370, GuardLogix 5570, Compact GuardLogix 5380, CompactLogix 5380, CompactLogix 5480, ControlLogix 5580, and GuardLogix 5580 controllers.
The DTOS instruction produces the ASCII representation of a value.
Available Languages
Ladder Diagram
Function Block
This instruction is not available in function block.
Structured Text
DTOS(Source,Dest);
Operands
Ladder Diagram and Structured Text
Operand | Type | Format | Description | Notes |
---|---|---|---|---|
Source | SINT
INT
DINT
REAL | Tag | The tag that contains the value | If the Source is a REAL, the instruction converts it to a DINT value. |
Destination | String type | Tag | The tag to store the integer value | String types are:
|
Description
The DTOS instruction converts the Source to a string of ASCII characters and places the result in the Destination.
Affects Math Status Flags
No
Major/Minor Faults
Type | Code | Cause | Recovery Method |
---|---|---|---|
4 | 51 | The LEN value of the string tag is greater than the DATA size of the string tag. | Check that no instruction is writing to the LEN member of the string type tag. In the LEN value, enter the number of characters that the string contains. |
4 | 52 | The output string is larger than the destination. | Create a new string type that is large enough for the output string. Use the new string type as the data type for the destination. |
See
Common Attributes
for operand-related faults.Execution
Ladder Diagram
Condition/State | Action Taken |
---|---|
Prescan | N/A |
Rung-condition-in is false | N/A |
Rung-condition-in is true | The instruction executes. |
Postscan | N/A |
Structured Text
Condition | Action |
---|---|
Prescan | See Prescan in the preceding Ladder Diagram table |
Normal execution | See rung-condition-in is true in the preceding Ladder Diagram table. |
Postscan | See Postscan in the preceding Ladder Diagram table |
Example
When temp_high is set, the DTOS instruction converts the value in msg_num to a string of ASCII characters and places the result in msg_num_ascii. Subsequent rungs insert or concatenate msg_num_ascii with other strings to produce a complete message for a display terminal.
Ladder Diagram
Structured Text
IF temp_high THEN
DTOS(msg_num,msg_num_ascii);
temp_high := 0;
END_IF;
Provide Feedback