9/30/2010 9:44 PM | |
Joined: 12/11/2009 Last visit: 9/8/2022 Posts: 243 Rating:
|
Hi I have many time (or TOD) and Date and Dateandtime values recorded in plc. I want to display them in wincc scada screen. How do you solve this problem? For now I'm doing as I described below and I have some problems. I found a cscript for wincc in siemens forum. It takes time information as decimal and it converts to string. I'm using this script in wincc. BUT When there are more then 20 time values in same page, when I open the page.. I have to wait about 15-20 seconds to see them. So I dislike it. Can you give me an example to convert the time value to string in plc side? So wincc will read as string so it won't spend any time.. I will creat one tag in wincc, all time information will be in it. I also want to ask it for Dateandtime value. I'm reading actual dateandtime information from plc. I'm recording it according to events. Then I display it bytes bytes.. But When there are 30 dateandtime value, it means 30 day information, 30 month information 30 year information, 30 hour information ....etc. 30x6=180 tags only for dateandtime Can you send me a fc block example which can converts Time and Date and Dateandtime to String? Thanks by the way: I don't know scl :( |
Last edited by: Osman_ at: 9/30/2010 10:13 PMLast edited by: Osman_ at: 9/30/2010 9:47 PMLast edited by: Osman_ at: 9/30/2010 9:46 PM |
|
This contribution was helpful to
1 thankful Users |
10/6/2010 8:55 PM | |
Joined: 12/11/2009 Last visit: 9/8/2022 Posts: 243 Rating:
|
where are the experts? |
10/6/2010 10:10 PM | |
Joined: 9/27/2006 Last visit: 3/14/2025 Posts: 12344 Rating:
|
Hello Osman; There are 2 ways I know of working with strings and DT variables. if you do not want to create your own FC to handle the conversion of every byte of the DT structure into a string and concatenate the strings with their seprerators. 1) oscat.de offers a free-downloadable set of functions that complement the Siemens instruction set in very interesting areas, math, complex math, double-floating point math, and conversions. One of the functions provided is DT_TO_STRF, and here is how its help is translated (using Babelfish): DT_TO_STRF converts DATE TIME a value into a formatted character string. The problem is that the documentation is German, but the online help is available in English (at least in the version I installed a few years ago). It is worth looking into. 2) Siemens proposes a Tool collection for converting data types: http://support.automation.siemens.com/WW/view/en/25629271 where you will find a function DT_to_String, Converting DATE_AND_TIME to STRING and vice versa. However,the code isnot free, it is sold through the Siemens AVC card, for 120 credits. For information on the AVC, look at http://support.automation.siemens.com/WW/view/en/28446694. Hope this helps, Daniel Chartier |
Last edited by: dchartier at: 10/6/2010 10:12 PMLast edited by: dchartier at: 10/6/2010 10:12 PM |
|
This contribution was helpful to
1 thankful Users |
10/7/2010 9:17 AM | |
Joined: 10/7/2005 Last visit: 3/14/2025 Posts: 3042 Rating:
|
Good question dear Osman_, and one for which I don't have the answer. Perhapsthey areall busy writingthe requested converter Blocks for you, or perhaps - like me - they can't offer youtheir own pre-programmed blocks for this. What I can at least offer you though is a link to www.oscat.de where you will find a Step 7 library(look for "oscat.lib 3.11 Step 7")which at leastcontains a DATE_AND_TIME to String converter Block (Name: DT_to_STRF). While it is programmed in SCL and the corresponding pdf documentation is in German, the code itself is commented in English and may be exactly what you are after (as well as serving as a starting block to develop the other convereter blocks that you need). I hope this helps |
Cheers |
|
This contribution was helpful to
1 thankful Users |
10/7/2010 12:12 PM | |
Joined: 12/11/2009 Last visit: 9/8/2022 Posts: 243 Rating:
|
Thank you fritz. Last night I found a way to convert time to string. I want to share it.We can use this stl code for converting Date/DateandTime to String too. Firstly I converted time to dint with MOVE. then I found hours/minutes/seconds. I converted them to BCD then I putted them in code written down. L bHH // hours byte in BCD-format SLW 4 OW AW W#16#F0F //Mask out rubbish OW W#16#3030 // ASCII for '0' T MW100 L ':' T MB102 L bMM // the same procedure for minutes : : : T MW103 //The converted string starts from MB100 .. |
This contribution was helpful to
3 thankful Users |
10/11/2010 9:58 AM | |
Joined: 10/7/2005 Last visit: 3/14/2025 Posts: 3042 Rating:
|
Need to bump this thread as I just noticed that THIS thread by Osman_ deals with the samesubject but containsreally good adviseby dchartier. As it turns out Daniels also refers to www.oscat.de BUT came first andposted his answer in the other thread a day beforeI made a similarpost in this thread. Before someone accuses me of plagirism, may I say that this is merely a case of "great minds think alike" (and fools seldom differ, your pick in which category you'd like to place me |
Cheers |
|
12/24/2017 5:58 AM | |
Joined: 7/27/2016 Last visit: 8/16/2023 Posts: 17 Rating:
|
I down load the file from the first link.. but then says it courrpt?
|
7/30/2019 9:35 AM | |
Posts: 17 Rating:
|
Here is a piece of code in SCL i wrote to solve this issue, You can modify the code to do the same for variables of type TOD and TIME, Cheers, AttachmentDT_TO_STRING.txt (4637 Downloads) |
Last edited by: Interlogis at: 07/30/2019 09:39:41 |
|
This contribution was helpful to
13 thankful Users |
4/22/2024 11:35 AM | |
Joined: 1/18/2023 Last visit: 3/7/2025 Posts: 3 Rating:
|
Just wanted to say thanks for this submission. It was almost exactly what i was looking for. A note to users who didn't know how to incorporate this code (as i did before i came across it). In order to be able to compile the code in your project, you save the file with the extension .scl, open your plc sub tree in the project inside TIA and find the External source files entry. In here you can add a link to the external file you just saved then right click and select Generate blocks from source. That will do what you needed and you can simply call the main FC from where you need it and jobs a good un. Best Regards |
6/7/2024 10:46 AM | |
Joined: 6/25/2020 Last visit: 3/6/2025 Posts: 1 Rating:
|
You are welcome. My coding years are way behind me now, but I am gladly surprised to see that peace of code downloaded 3500 times ! |
Follow us on