Siemens S7-300 PLC TİME TO STRİNG CONVERSİON

pokajy

Member
Join Date
Mar 2008
Location
Turkish
Posts
53
Dear Experts,
I asked this question to many people but still could not get an answer.
I hope you can answer me.

I have about 30 TOD (or Time) values recorded in plc.
I want to display them in wincc scada screen.
When I use c or vbscript in wincc, wincc runs very slowly.
So I want to convert Time values to String (hh:mm:ss) in plc and display them in wincc.

Do you have any conversion block?
DI_String does not work. It only creats string with decimal numbers.

I also need conversion block for DATEANDTIME.

Thank you for comments.
 
You can try this untested variant.
The converted string starts from MB100 ..
(You might have to add some formatting in the front and perhaps appostrophs - I think JesperMP has written about it in the forum ).

L bHH // hours byte in BCD-format
L bHH
SLW 4
OW
AW W#16#F0F //Mask out rubbish
OW W#16#3030 // ASCII for '0'=30h (not sure)
T MW100
L ':'
T MB102

L bMM // the same procedure for minutes
:
:
:
T MW103

Kalle
 
Here's some code to get your teeth into. Your pass a date and time to FC1 - the TOD is extracted and converted to a string in the form hh:mm:ss

Note that you cannot monitor date and time or strings in a db so I have tested the code in plcsim and then copied the online dbs to the offline folder to fill in the actual values of the strings.
 
Another idea

You can create a struct in plc and a structure tag in WinCC which represent integers as hour, min, sec. I think your code would be much more understanble because I always find working with strings hard for plc platform so I avoid it as much as possible. Since two structure will match you wont have too much problem and also you can use monitor ints online in plc.
 
Thank you all for helps.
I solved my problem last night with KalleOlsen's stl code.It's just working great.
I converted time to decimal dint. Then I found hour-minutes-seconds.I converted them to BCD and I putted in KalleOlsen's code. Result is ok.
 

Similar Topics

Hello. There is a problem with Siemens S7 300. We got a replacement PLC but it does not run the program from the MMC. The new PLC is dated 2011...
Replies
3
Views
689
Is there a version of Siemens software that can be used to view only the installed program logic and diagnostic buffer to determine system and bus...
Replies
5
Views
2,093
Dear Friends; We have a BOBST 1228 flexo printing machine having Siemens S7-300 PLC (6ES7 318-3EL01-0AB0) and Lenze 9300 and 9400 drives. The...
Replies
3
Views
2,306
I set the Date and Time of the S7 300 PLC equal to that of my PG. But after a few days I found that the date and time were not what they should...
Replies
0
Views
1,917
Hi Can any one give me some of sample project file for Siemens S7 300 PLC that I can practice at home. Thanks in Advance
Replies
2
Views
2,797
Back
Top Bottom