Adding Bool & INT

maico

Member
Join Date
Jun 2012
Location
Belfast
Posts
27
Hi All,
In siemens S7 is it possible to add the value of a Bool to an interger ie if I am adding 15 intergers together but have a further 2 Bool parameters to add is it possible to add them to the total sum?
Thx
 
Well a BOOL will either be equal to '1' or '0' so it would be easy enough to just have some Ladder logic to say...
If 'myBOOL' then ADD 1 to 'total' (where 'total' is the sum of your other INTs)

Or something like this in STL...
Code:
A  myBOOL
JNB  M001
L  myTotal
L 1
+I
T myTotal

M001: NOP 0

You would obviously have to make sure it didn't add every scan but something along those lines would work.
 
with couple move blocks or selection block you can make temperary variable which has value of zero or one, then add all ints together.

Siemens STL don't type compare variables, so you can also count variables there.
 

Similar Topics

Hi Everyone, Currently we have three plants running with Controllogix PLCs (L72, L73, L74). In each of these plants we have 2 FTView SE...
Replies
0
Views
55
Hello, Im building project with 1756-L82ES controller and 1756-IB16S card but i cant find it when trying to add the card to IO configuration...
Replies
3
Views
135
Hello, I have a pair of redundant 1756-L71 controllers rev 24. These controllers currently have produced and consumed tag interfaces to 3 other...
Replies
2
Views
159
I'm adding an IAI Gateway with 2 axes connected to it. To an ethernet network on my PLC. So, I think the math is correct on the Input and Output...
Replies
0
Views
143
Hi Folks. I am gearing up to add a 2nd identical HMI to a project. This 2nd HMI will basically be an exact clone of the 1st one. The equipment...
Replies
3
Views
258
Back
Top Bottom