step 7 small question

Since WORD data types are logic patterns, rather than values, you then need to start thinking about using logical operators rather than arithmetic operators such as 'compare'.

Fortunately there are only a few logical operators: AND, OR, XOR.
Let's consider the result of these on two WORDs with identical and different bit patterns -

AND Result if identical: Output is identical to both inputs
AND Result if different: Output has unpredictable pattern
OR Result if identical: Output is identical to both inputs
OR Result if different: Output has unpredictable pattern
XOR Result if identical: Output is all '0'
XOR Result if different: Output has unpredictable pattern

I don't know what you want to do with the result of this operation. Even in the only case where you can predict the output I'm not sure of the most appropriate method to detect whether this condition exists or not?

Regards

Ken

(PS : Can someone check and confirm or deny my logic? The more I re-read it, the more doubts I have about it!)
 
No problem

Hi,

you can not do it in LAD or FBD but with STL it is not a problem. You can use 16 bit integer comparison.

Example:

L WORD1
L WORD2
==I //If values are same RLO=1

It does not matter if it is WORD or INT

Good luck,
MM
 
Last edited:
I would just do the compare in STL. There is no typechecking in STL so dont worry that one is an INT and the other a WORD or they are both WORDs.

edit: crossposted with maitomies.
 
Hello sahayan;

You just need to add a =Q0.0 to Maimonides' example.

Whenever you have a doubt on STL, just program your network in LAD, in this case use a EQ_I box with 2 integers and an outout, then go to View and display the network in STL. It should give you a good idea of the STL syntax required in your application.

LAD_STL.jpg



Hope this helps,
Daniel Chartier
 

Similar Topics

I am having a step7 v5.4 program where the blocks are encrypted and locked. And the manufacturer is stopped the support. Is there any ways to...
Replies
2
Views
181
Good Morning, Hoping someone with some Siemens experience can give me a hand with this one. Customer has a S7-200 cpu, which has a 6GK7...
Replies
0
Views
253
HI! HOW COULD I OBTAIN THE NAMES OF THE STEPS OF A ROUTINE IN SFC LANGUAGE IN STUDIO5000? Or is there a system variable that gives me those...
Replies
0
Views
343
I'm just trying to figure out the right method of adding a DO card to an existing rack. It's not the *next* open slot, but I have to move the AO...
Replies
5
Views
557
Hi Siemens Experts, I am hoping someone can shed some light on my issue. I have uploaded the code from a S7-300 (317-2PN/DP) using Step 7...
Replies
9
Views
690
Back
Top Bottom