Siemens Step 7 Count Number of Bits Store Result as Integer

Galaniz

Member
Join Date
Feb 2012
Location
Corpus Christi
Posts
34
I am using Siemens Step 7 with an S7-400 Procesor. I am looking for a sleek way to count a number of bits and store the result as an integer.

My specific application requires me to know the number of valves open without error. Each valve open without error will provide a bit indicating such. I would like to take all the bits (9 in this case) and determine if 2 or more are open.

I can do this in 45 wrungs by placing all the combinations in pairs in series, but surely there must be a better way.

Any Ideas?
 
So all nine in parallel with each one having its own positive edge bit to trigger and up count, and something similar for down count. That may work,
 
I would put a elapsed time between each input and the set of the counter.

You can have a situation where the PLC when takes the picture of the inputs, it will set several bits, and all of them will result in only one position up in the counter.

If you delay between them, you will be certain that each input will be scan individually and influence individually the counter.

Regards
 
If they are in 1 word, i/e/dbx.dbwy then

L dbx.dbw1y
T #tmpholder

L 0
T #Count

L 9
CNT: T #LoopNumber

L #tmpholder
SRW 1
T #tmpholder
JZ over

L #Count
+1
T #Count

over: L #LoopNumber
LOOP CNT
 

Similar Topics

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
243
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
544
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
660
Hello, We monitor the temperature of a pipe via a 4-20mA temperature transducer. This goes into DB135(Read Analog Inputs). The issue I have is the...
Replies
0
Views
624
Please excuse the basic question, but I've never worked on Step 7 before (until now, only dealt with Mitsubishi Q-series PLCs)... What is the...
Replies
16
Views
3,324
Back
Top Bottom