[?]: OB35 - 100ms

SIMATIC S7-200/300/400, Step7, PCS7, CFC, SFC, PDM, PLCSIM,
SCL, Graph, SPS-VISU S5/S7, IBHsoftec, LOGO ...
Post Reply
nashama
Posts: 50
Joined: Thu Apr 21, 2011 9:37 am

[?]: OB35 - 100ms

Post by nashama » Sun Jun 23, 2013 7:57 pm

Hello,

The following codes are meant to display time in seconds using OB35.

OB35:

Code: Select all

AN M1.0
=   M1.0
FC1:

Code: Select all

A M1.0
FP M1.1
L DB1.DBD0     // ZAHLER
+ L#1
T DB1.DBD0    // ZAHLER
L 100   //[b]bold letters[/b] 
<>I
JC NEXT
L DB1.DBD4    // DISPLAY SECONDS
+ L#1 
T DB1.DBD4   // DISPLAY SECONDS
L 0
T DB1.DBD0   // ZAHLER

NEXT: NOP 0
I do not understand why the "ZAHLER" value is compared with 100 (the STL statement highlighted in bold letters above).

If OB35 is called every 100ms, then, it should be checked for 10 to estimate every one second occurence. But the program works good with 100 and not with 10 when checked on S7-PLCSIM.

Is there some thing wrong with the codes or am i not understanding it properly?
Any thoughts?

almaz78
Posts: 108
Joined: Tue Dec 16, 2008 7:36 pm

Re: [?]: OB35 - 100ms

Post by almaz78 » Mon Jun 24, 2013 4:36 am

You right, to count seconds you need to compare it with 10.
program works fine with 10. may be you download FC1 with comparison to 10 when db1.db0 was greater then 10? in that case program wont work unless you set db0.dbd0 less then 10.

fc1 called from ob 35?

nashama
Posts: 50
Joined: Thu Apr 21, 2011 9:37 am

Re: [?]: OB35 - 100ms

Post by nashama » Mon Jun 24, 2013 11:40 am

Thanks for the reply.

FC1 is not called from OB35.

It is called from OB1 only.

Is that the error?

Regards

almaz78
Posts: 108
Joined: Tue Dec 16, 2008 7:36 pm

Re: [?]: OB35 - 100ms

Post by almaz78 » Mon Jun 24, 2013 1:19 pm

Yes,

If fc 1 called from ob1 its not counting seconds, but program scans, you need to call it from ob 35. whats the purpose of m1.0 it doesnt do anything in fc1....

nashama
Posts: 50
Joined: Thu Apr 21, 2011 9:37 am

Re: [?]: OB35 - 100ms

Post by nashama » Mon Jun 24, 2013 1:43 pm

Thanks again.

But then what is the rationale behind that 100?

How come it gives correct results with 100 even though FC1 is called from OB1 and not in OB35??

rEGARDS

nashama
Posts: 50
Joined: Thu Apr 21, 2011 9:37 am

Re: [?]: OB35 - 100ms

Post by nashama » Mon Jun 24, 2013 1:45 pm

Besides, my undertsanding was that M1.0 will come true avery 100ms even though the codes are written in FC1.

Regards

nashama
Posts: 50
Joined: Thu Apr 21, 2011 9:37 am

Re: [?]: OB35 - 100ms

Post by nashama » Mon Jun 24, 2013 2:13 pm

And just noticed, there's a missing part after that FP M1.1.

A M1.0
FP M1.1
JCN NEXT
L DB1.DBD0 // ZAHLER
+ L#1
T DB1.DBD0 // ZAHLER
L 100 //bold letters
<>I
JC NEXT
L DB1.DBD4 // DISPLAY SECONDS
+ L#1
T DB1.DBD4 // DISPLAY SECONDS
L 0
T DB1.DBD0 // ZAHLER

NEXT: NOP 0

almaz78
Posts: 108
Joined: Tue Dec 16, 2008 7:36 pm

Re: [?]: OB35 - 100ms

Post by almaz78 » Tue Jun 25, 2013 3:14 am

with JCN NEXT it makes more sence, however the program still doesnt work properly. yes you see db1.dbd4 counting but its not the right count of seconds.

Note that m1.0 will be true after first call of ob35, on second call it will be false, so it gives you one pulse per 200ms

to get proper seconds count you can:

1. put this part of fc 1 in ob35. note: compare with 10

Code: Select all

L DB1.DBD0 // ZAHLER
+ L#1
T DB1.DBD0 // ZAHLER
L 10 //bold letters
<>I
JC NEXT
L DB1.DBD4 // DISPLAY SECONDS
+ L#1
T DB1.DBD4 // DISPLAY SECONDS
L 0
T DB1.DBD0 // ZAHLER

NEXT: NOP 0
2. call fc1 from ob1, but reset m1.0 in NEXT jump and still compare with 10

Code: Select all

NEXT: NOP 0
         clr
         =m1.0
why dont you want to use clock bit?

nashama
Posts: 50
Joined: Thu Apr 21, 2011 9:37 am

Re: [?]: OB35 - 100ms

Post by nashama » Tue Jun 25, 2013 2:32 pm

Dear almaz78,

Will try those codes & get back to you.

Yes, CPU Clock mem is an option for this kind of application .........but ....... I's just curious to dig more on the existing codes !!

What is your opinion in such a situation - is it better to use OB3x or better to use CPU Clock pulses? which one is more accurate if timing should be close to precise?
Using OB3x will have any affect on the scan cycles or OB1?

Regards

almaz78
Posts: 108
Joined: Tue Dec 16, 2008 7:36 pm

Re: [?]: OB35 - 100ms

Post by almaz78 » Wed Jun 26, 2013 1:41 am

Personally, I would rather use real time clock, but probably its not right :)

I think that OB35 is better, but i think that only counting part needs to be in ob35

Yes, ob35 or any ob affect scan time. remember that on execution of ob35- ob1 stopped

nashama
Posts: 50
Joined: Thu Apr 21, 2011 9:37 am

Re: [?]: OB35 - 100ms

Post by nashama » Thu Jun 27, 2013 11:47 pm

Dear almaz78,
Actually, it was my misunderstanding with the occurence of OB35.
By default it comes every 100ms which means M1.0 will stay on for 100ms and off for another 100ms and so on (thanks for your advice as well in your 2nd last post).
That means M1.0 will have a rising edge every 200ms and after 5 such rising edges we reach to 1s.
So, I just replaced that 100 with 5 and the results were correct.

Code: Select all

A M1.0
FP M1.1
JCN NEXT
L DB1.DBD0 // ZAHLER
+ L#1
T DB1.DBD0 // ZAHLER
L 5 //bold letters 
<>I
JC NEXT
L DB1.DBD4 // DISPLAY SECONDS
+ L#1 
T DB1.DBD4 // DISPLAY SECONDS
L 0
T DB1.DBD0 // ZAHLER

NEXT: NOP 0
Note that FC1 was still called from OB1 only and not from OB35.
DB1.DBD4 now counts every second correctly on my S7-PLCSIM.

Regards

Post Reply