7/28/2012 5:21 PM | |
Joined: 4/21/2007 Last visit: 7/25/2022 Posts: 39 Rating:
|
Chris, I plan to use a function block to convert the hours, minutes, and seconds components of a DTL data type to a string formated hh:mm:ss then mapthe string version of the timeto a string output field on the HMI. Your request prodded me to write the function so I attached it here. Note I have not loaded this in a PLC and tested it yet. I will do so when I get back to my office next week. Note there are two versions of the function, one written in LAD and another in SCL. I used this little project to get started with SCL as I have never used it before. Kevin AttachmentDTLtoTimeString.zip (1827 Downloads) |
Last edited by: O_Moderator at: 7/30/2012 11:46 AMnew subject after splitting from /tf/WW/en/Posts/77967#top |
|
7/31/2012 1:20 PM | |
Joined: 10/10/2005 Last visit: 11/21/2022 Posts: 1909 Rating:
|
Hello, I recommend to save the variable with the structured data type DT in a DB and you can access to the separate components YEAR, MONTH, DAY, ... with their data type USInt. See the following FAQ: http://support.automation.siemens.com/WW/view/de/43566349 Then change the data type of each component from USint to DInt (function "CONV") and after from DInt to String (function "S_CONV"). See the following examples in the next FAQ: http://support.automation.siemens.com/WW/view/de/48711306 With best regards |
Follow us on