Jump to content

Recommended Posts

Posted
I have a block that mimics the AB TON functionality. The ACCUM and Setpoint are both TIME data types. I need to turn on a warning light when I have a time difference of 10s between ACCUM and Setpoint. Can I convert the TIME data to an Int? Or is there any way to do this? It almost seems like I will need to change all my TON data types to a standard S_ODT timer. It already has the remaining time etc, I would just need to convert it from BCD to Int.
Posted (edited)
So I'm trying to use the S_ODT timer now. I can choose the BI time left address, which is a WORD, or the BCD. Siemens has no WORD to INT converter, and BCD is not an optional data type when I create a tag. I need to compare either the BI or BCD to 10 in order to start flashing my light. How can I do this? ETA: Nevermind, I was only looking in the LAD help. I can do it in STL. Edited by IamJon
Posted (edited)
I WAS going to use that, but I can't do anything with the TIME data type that uses. I'm switching to the S_ODT timer. Even though the BI is a WORD data type, it seems if I do a <I in STL, it lets me compare a WORD with an integer value of 10. Sound correct? ETA: It saved and compiled, so I think I got it. And yes, it was SFB4. Edited by IamJon
Posted
The TIME format is mS, as Siemens describe "The data type TIME is stored with milliseconds prefix as two's complement INTEGER" a value of 1000 = 1 second.
Posted (edited)
Just talked to Siemens. Apparently I can simply do a MOV function to move the WORD data type to INT, then do an integer compare with 10. And just to clarify, I ended up using the S_ODT timer. Edited by IamJon
Posted
IamJon, I suggest you use the IEC timer TON, as the S5Timers are really an arcaic leftover from S5. To do math with a TIME variable, switch to STL mode, since there is no typechecking in STL. You can switch back to LAD or FBD, only the rungs that no longer can be represented as LAD or FBD will display as STL.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...