7/28/2012 5:21 PM | |
Joined: 4/21/2007 Last visit: 1/10/2024 Posts: 39 Rating: (0) |
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 (2588 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/27/2024 Posts: 1921 Rating: (136) |
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 |
6/16/2023 9:48 AM | |
Joined: 4/14/2018 Last visit: 12/5/2024 Posts: 48 Rating: (1) |
@last_bu as you said I have downloaded LGF (Library of general functions) from siemens link and i think it is easy to use. You can download the library from the link and open it in Tia library section, and use DTLtoStringDE converter to convert DTL to String format. There are two options available DE and ISO time formats, I have used DE and it worked fine. the block will ask for separator I have used a tag with String data type and '-' in initial value |
Last edited by: Jen_Moderator at: 06/19/2023 07:41:31Link optimized.
|
|
This contribution was helpful to1 thankful Users |
Follow us on