Boolean -> Integer conversion for 90-30

denman_100

Member
Join Date
Dec 2007
Location
Winnipeg
Posts
9
Hi,

Is there a boolean to integer conversion for the GE 90-30 PLCs? I want to determine how many fans are running, (%I1 - 20). I was going to convert each input to a 0 or 1, then add them up to determine how many are running. Right now I have 2 rungs for each input, one to move a 0 into an variable or a 1 into that variable depending on the value of %I1 for exmample. Is there a more efficient way of doing this?

Thanks
 
There is no instruction in the 90-30 function set to count the number of bits set over a range. You will have to roll your own routine.

Her is a possible rutine:

First create a DWORD variable with address %I0001. Then AND that variable with hex 000FFFFF. This will let you use the other twelve inputs elsewhere in your program.

Move a zero into a register to be used as an index. Also move zero into your "Number of Bits" register.

Use the "LABEL" instruction to create a target for a "JUMP" instruction.

Use the bitwise shift right instruction to shift the bit pattern of the DWORD variable you created earlier. If a "1" gets shifted out, add 1 to "Number of Bits".

Unconditionally add 1 to the Index.

If the Index value is less than 20, JUMP back to the LABEL.


Be very careful with the JUMP instruction when JUMPing to a rung earlier in the ladder logic. If you make a mistake and get stuck in the loop for longer than 200 milliseconds, the PLC will crash on a "Watchdog Timeout" fault.
 

Similar Topics

Hi, I need to decode the integer value to boolean and store the each bit of 16bits in different variable of boolean type and to be used in the...
Replies
7
Views
2,449
Hi, I need to decode to the integer value to boolean and store the each bit of 16bits in different variable of boolean type and to be used in the...
Replies
2
Views
3,417
Have beginner knowledge of digital controls, and intermediate/advanced knowledge of socket clients and listeners (written logging proxies, socket...
Replies
9
Views
3,727
Hi, I am trying to convert an array of Booleans into an integer so that I can use it to display a message on a SCADA system. I have looked on...
Replies
22
Views
16,716
Hi. I haven't touched an Allen Bradley PLC for more than 10 years and I'm kind of rusty. I want to do something really simple in a FBD section...
Replies
5
Views
847
Back
Top Bottom