Reading S7-300 CPU time

Mrslipmat

Member
Join Date
Mar 2009
Location
Inside a cabinet somewhere....
Posts
199
Hey guys, good day to you all

Once again i find myself needing to ask for advice :oops:
I,ve been trying all day to setup and read the time out of a S7-300 cpu315. i,ve tried almost everything, SFC0, SFC1, FC8 etc... no matter what i seem to do i keep getting errors on the inputs, on the outputs etc.

I am litterally pulling my hair out at the moment, I,ve spent most of my time on AB software and could do this in a doddle reading status bits from the cpu, Siemens S7 is another story though... Wow is this software hard to get your head around....o_O

What I am trying to accomplish is to read the cpu time value and compare it with a preset time value, so I can start a process off and finish it at a set time... well that,s what i was thinking of anyway, now I,m thinking sod it off to the pub !

Any help or pointers would be most appreciated

Kind Regards

John
 
Hi seppoalanen, thanks for your reply

I did actually see the OB1_DATE_TIME type variable and wondered if i could use that, I tried addressing a couple of functions with the variable as an input but couldnt get them to work, All it seemed to do was highlight the input in red so I assumed it was not possible to use.

What would I need to use, and how would I address it so i could read this variable into a FC ? I am busy climbing a steep learning curve with the S7 software and some of the explanations in the help files do get a bit confusing from time to time !

Kind Regards

John
 
"OB1_DATE_TIME" seems to be in local address L12.0
Declare DATE_AND_TIME type variable e.g. DB10.DBX0.0

In OB1 do network, in STL it shows like this:
L LD12
T DB10.DBD0
L LD16
T DB10.DBD4

In VAT table you can see it (BCD-coded!!)
DB10.DBB0 HEX B#16#09 // year
DB10.DBB1 HEX B#16#05 // Month.. etc
....
DB10.DBB5 HEX B#16#49 // seconds
....
DB10.DBB7 HEX B#16#13 // where 3 = Tuesday
 
Hi seppoalanen, thanks for your reply

I,ll give it a go and see what happens, I did manage to find that if I used this format in OB1,

L LB 12 // Year
L LB 13 // Month
L LB 14 // day
L LB 15 // Hour
L LB 16 // Minute
L LB 17 // Second

then i could see the time and date online, it was the problem of moving that over to a FC to incorporate into the programme...

I,ll give your example a go an see what happens

Thankyou for your valued help

Kind Regards

John
 
The "OB1_DATE_TIME" variable is output for OB1 Start Time!
Literally it is the time of STOP->START mode transition

Use SFC0, transfer PDT output to local variable DATE-TIME type or to a DB. To move it use SFC20 (BLK_MOV).
Cheers
 
The "OB1_DATE_TIME" variable is output for OB1 Start Time!
Literally it is the time of STOP->START mode transition

Cheers

This is a widespread myth, the Date and Time info in the OB1 Local variables are updated every cycle.

If you want to check it out just copy the Bytes to some free Marker area and view them in a VAT.
 
Guys, many thanks for your replies

I,ve tried the routine provided by seppoalanen on the kitchen bench, needless to say the wifes not to happy with all the wires etc running around !

L LD12
T DB10.DBD0
L LD16
T DB10.DBD4

This is in fact giving me the real time clock from the plc and is working fine, i,ve copied these into a fc just to check the outcome, it,s giving me the correct date and time from the plc clock...

Does this mean:

The "OB1_DATE_TIME" variable is output for OB1 Start Time!
Literally it is the time of STOP->START mode transition

Is actually a myth ?

Kind Regards

John
 
The "OB1_DATE_TIME" variable is output for OB1 Start Time!
Literally it is the time of STOP->START mode transition

Use SFC0, transfer PDT output to local variable DATE-TIME type or to a DB. To move it use SFC20 (BLK_MOV).
Cheers
It works with PLC-SIM in real time try it, declare description is fallacious. OB1 starts in every cycle.
 

Similar Topics

How can I reading 0-65535 value reading from PIW258 address? I want to reading position parameter from Control Techniques Unidrive M600-M800...
Replies
5
Views
3,223
Hi I have never used a Lenze system before and so far I'm not enjoying much about it. I have 3 thermo modules EPM-S405 and I don't seem to get...
Replies
4
Views
2,174
Hi everyone, As I am new to S7-300. i configured S7-315-2DP with 2 input card & 1 output card..with AI8 RTD module in which 6 i/p's are used and...
Replies
1
Views
1,968
I'm using FC105 Scaling block for analog periphery reading.Are there any reading difference of betweens voltage,current,resistor,thermocouple for...
Replies
3
Views
2,485
Hello, I have an S7300 plc (cpu 317 PN/DP) and i want to see realtime values in an Excel sheet. I think that i should use an OPC Server, so i...
Replies
3
Views
2,586
Back
Top Bottom