S7 - Understanding the ROL Bit and SET & CLR

RMA

Member
Join Date
Sep 2004
Location
North of Hamburg, Germany
Posts
2,052
Having spent the best part of a day chasing an intermittent fault which turned out to be that the Bit I was using to provide the edge to start some Timers very occasionally was getting set on the first run through the Block, so I had to move the command setting the Bit down behind the Timer Networks and finished up with the following:

Code:
	 SET						 //These 2 lines 
	 S	 #Trigger_LTS		 //were moved
	 CLR						 //and this was added
 
	 O	 #RM_HVR_NEG		 //previously the Block started here
	 O	 #RM_HVR_POS
	 ON	#RM_LTS_NEG_AUF
	 ON	#RM_LTS_POS_AUF
	 BEB 
 
	 SET 
	 R	 #DUMP_Relais

Am I right in thinking that if I don't use the CLR here, because the ROL is set when the ORs are executed, the conditional Block end will always be executed?

This reminds me of another thing that I've wondered about a few times. I reckon the above string of ORs would be functionally identical if the first one (and only the first one) was replaced by an AND.

Am I correct in my thoughts, or do I still not really understand how this stuff works? o_O
 
Last edited:
RMA said:
This reminds me of another thing that I've wondered about a few times. I reckon the above string of ORs would be functionally identical if the first (and only the first one) was replaced by an AND.

Am I correct in my thoughts, or do I still not really understand how this stuff works?
hmm.gif

That's right ....but as Berger says:

"... For the purpose of intelligible programming, the rule of logic for the first check should be identical to the desired function."

I just love that guy....


Kevin
 
RMA said:
Am I right in thinking that if I don't use the CLR here, because the ROL is set when the ORs are executed, the conditional Block end will always be executed?

No, that isn't right, Roy. As soon as you have evaluated the SET command, and started new logic with conditional operands, it's a whole new ballgame, and the BEB will be conditional upon the OR statements.

For instance, check this out:

A I 1.0
= M 1.0
A I 2.0
= M 1.1
JC M001

The JC is dependant on I2.0 only, and it doesn't matter what I 1.0 is. Now let's look at this:

SET
= M1.0
A I 2.0
= M 1.1
JC M001

It's the same thing. The SET has no influence on the following logic.
 
RMA said:
Code:
...
CLR	 //RLO is set to FALSE 
O	 #RM_HVR_NEG //RLO will be set depending of the OR conditions.
O	 #RM_HVR_POS		 
ON	#RM_LTS_NEG_AUF
ON	#RM_LTS_POS_AUF
BEB 
...

Am I right in thinking that if I don't use the CLR here, because the ROL is set when the ORs are executed, the conditional Block end will always be executed?
Are #RM_HVR_NEG and #RM_HVR_POS the inverse of each other ? If so your OR logic will allways evaluate TRUE.

RMA said:
I reckon the above string of ORs would be functionally identical if the first one (and only the first one) was replaced by an AND.
Because you have set the RLO to FALSE with the CLR command, AND'ing it will always return FALSE, so it is not the same. But if you remove the CLR and change the 1st OR to an AND, then it will be the same.

(new network, or start after =, S or R)
A
O
O

will be work the same as

(new network, or start after =, S or R)
CLR
O
O
O

I think that your code is correct. Only it is a bit more confusing to write CLR and O when starting a new network.
 
Are #RM_HVR_NEG and #RM_HVR_POS the inverse of each other ? If so your OR logic will allways evaluate TRUE.



No the four signals are two from HV Relays which have only a single feedback contact for the ON condition and two motor-driven switches which have feedback signals for both ON and OFF. In each case one device is switching the positive line and the other switches the negative line.

No, that isn't right, Roy. As soon as you have evaluated the SET command, and started new logic with conditional operands, it's a whole new ballgame, and the BEB will be conditional upon the OR statements.

I'm missing something here and I think I know approximately what it is, but I seem to be missing some details.

What I was worrying about in my example above was that when I set the ROL Bit with my SET, it doesn't get cleared when I use an =, R or S after it, because I can (and frequently do) string a whole line of them one after another. So I was a bit worried that my first OR would respond to this ROL being present and pass it on down the chain.

5 minutes digging through Berger later and I've answered my own question. I (was pretty sure I) knew that there was a bit in the Status Word which said that you were starting a new chain of logic. What I wasn't so sure of was when it got set and cleared. Berger told me which Bit it is - the LSB of the Status Word, /ER for "Erstabfrage" or First Query - and the STL handbook tells me the rest (Status Word doesn't even appear in the index of the STL Handbook - apparently you're expected to know all that stuff before opening the book!).

For the benefit of anybody else who might not be absolutely certain on the details, you can summarise it like this:

All the Query commands like A, O, AN, ON, X and XN set the /ER Bit to a "1", the operations using the results of the logical operation, =, R and S, set the /ER Bit back to zero (*). The change of the /ER Bit from "0" to "1" signals the start of a new set of operations.

So the answer to my question is now clear, the CLR I put in just to be on the safe side is redundant and will be being removed forthwith!

* Partial exception, the commands which initiate a set of nested operations U(, O(, UN(, etc. also set the /ER back to zero, which is pretty logical when you think about it.
 

Similar Topics

I am using Allen Bradley PLC for Ethernet/IP communication. I send any explicit msg request (Get attribute or Set attribute), I observed packet...
Replies
0
Views
46
Took a new job and the controls schemes are fairly old and I'm used to Allen Bradley and Siemens. I'm looking to replace a pair of Superior...
Replies
1
Views
85
Hello Team, I am desperate for some help with an assessment I have as part of a Level 3 general engineering course. I am in a role that is much...
Replies
9
Views
290
Good day is there somewhere i can see the situation and compatibility regarding different firmware revisions. I have a 2711-K5A5, series H and...
Replies
4
Views
186
Good Evening , I should know more about Solid State Relays . I have a system with 8) 120 vac Vibrators . These Solid State Relays have...
Replies
24
Views
1,941
Back
Top Bottom