AB Micrologix 1000, checking bit status sequentially??

timbo_uk

Member
Join Date
Nov 2005
Location
Bradford, UK
Posts
336
Giving myself a headache here!

I have worked with plc's for a few years, but new to programming.

Basically I am wanting to check the status of 8 fault flags (B3:0/0 to B30:0/7)

If any of the flags are high I need to flash a fault code to a single lamp output. The fault code will actually be "bit number + 1 flashes". BUT if more than one is high (eg bit 0 and bit 7) then I need flash the output as follows: 1 flash, pause, 8 flashes, pause.

I am trying to work out how to read the individual bits according the the accumulator in a counter. ie B3:0/x (where x is the counter acc). The flash number will then simply be the counter acc loaded into another counters preset (via an integer flag?)

Hope this makes sense!

Any suggestions will be gratefully received.
 
Timbo,

Yes, it makes sense. A counter (or timer) can be used if you load the B3 word into the counter accumulator (ACC) word. You could set up a self-resetting timer, say T4:0, timing from 0 to 255, in 0.1 second increments. Then set up a comparison statement, "If B3:0 = T4:0.ACC, then (go to flasher routine).

However, because you only have 8 bits to check, an easier way might be just to use eight comparison statements.

For example, if the Xth bit is on or 1, then decimal value of the word then will be 2^X. Set up eight EQU comparsions like this: "If B3:0 = 1, then (flash output 1 times); If B3:0 = 2, then (flash output 2 times); If B3:0 = 4, then (flash output 3 times)", and so on. This works for ONE bit on, where there will be nine possible values: 0,1,2,4,8,16,32,64,or 128. It gets a bit involved to check for TWO bits on at same time. For that, a "mask" instruction might be useful. Or you could divide the program into two main sections. The first section or subroutine checks to see if only one flag is set. If B3:0 is not equal to 0, and also is not equal to any of the other 8 numbers, then TWO bits must be set, and the program diverts to the second second, where a series of comparison LIM statements zeroes in on the actual two or more bits.

These are first thoughts and there are probably a hundred different ways to do this. I am sure someone will come up with a better method.
 
Last edited:
Timbo,

You might take a look at the "Downloads" section above. In the Allen-Bradley section there is an Alarm Code routine that allows up to 99 individual alarms. This is another approach to your problem.
 
Well I have uploaded it.
Its dirty, but it does work. The only problem really is that if unit 1 and 8 are in fault there is a slightly too long a pause between these two fault codes being shown.

Any comments on it would be much appreciated đź““

Cheers
 
Timbo uk,

This is an example of the routine I would use on small machines with fifteen or less faults, modified to meet your needs. It works equally as well, with some modification, for message display on a HMI. With some effort it could be modified to provide more than fifteen faults. The sequencer could be replaced by a bit shift instuction, with some effort, if you are so inclined. Hope this helps.

Be Advised: If you plan to ask for help in the future it would behoof you not to insult the provider. I do not know any programmers that respond well when their code is called "dirty".
 
Timbo,

I reviewed your program. Like you said, there are long pauses between codes 1 and 8. I made some changes (ONLY IN THE LADDER 6 routine) and tried to improve on your method, attached as "Revision 1" zipped compressed file. I added a timer T4:19 "TIME BETWEEN CODES". This allows an independent pause ONLY when a code has been triggered. Otherwise, the scan counter marches along rapidly at a set pace, controlled by the internal time base S:4/7 bit, instead of your two timers T4:17 and 18. I reduced the number of rungs in Ladder 6 from 25 down to 13. I tested it out on the LogixPro simulator, and it works great.
 
Last edited:
Timbo,

I meant to say that if the S:4/7 flasher time is too slow for your needs, then you can substitute S:4/6, or S:4/5, and so on down to S:4/0. I think that I used S:4/7 in only two places.
 
Lancie1 said:
Timbo,

I reviewed your program. Like you said, there are long pauses between codes 1 and 8. I made some changes (ONLY IN THE LADDER 6 routine) and tried to improve on your method, attached as "Revision 1" zipped compressed file. I added a timer T4:19 "TIME BETWEEN CODES". This allows an independent pause ONLY when a code has been triggered. Otherwise, the scan counter marches along rapidly at a set pace, controlled by the internal time base S:4/7 bit, instead of your two timers T4:17 and 18. I reduced the number of rungs in Ladder 6 from 25 down to 13. I tested it out on the LogixPro simulator, and it works great.

Super star!
Ill have a look this morning; 6:15am and 2 breakdowns in allready!
 
k.dougherty said:
Timbo uk,

Be Advised: If you plan to ask for help in the future it would behoof you not to insult the provider. I do not know any programmers that respond well when their code is called "dirty".

Ooops, that was not clear. Sorry.

I meant MY code was dirty, no offence meant at all! I had worked it out myself to actually make it work, but I classed my inexperianced ladder writing as dirty!

The suggestions about how to do it were actually read after. I really do appreciate the help I have had from here; one day I would love to be able to give a bit back!

BTW tried the code out on my test rig; just after the enf of the fault code display I get a very short additional output from the fault o/p. You can hear the relay "blip" and just see the o/p led flash. Just trying to see why now.
 
Timbo,

I see what you mean. Here is a fix. In Lad 6, Rung 10, replace the O:0/9 contact with two, B3/12 and S:4/7, the sames ones on Rung 9. This seems to fix the phantom flash.
 
Timbo,
I have been working on a similar project myself at work and came across the same problems you seem to have encountered. One of the other elctrical wizz kids sorted this problem for me so I will get him to give you a reply for this problem.

All the best

Carl
 

Similar Topics

"Hello! Good day! Excuse me, I have a question regarding the 1761-NET-ENI. RSLinx has already detected it but it's not connecting to the PLC...
Replies
4
Views
154
Hi all, We have a very old pit pump system running on Micrologix 1000. Now, whenever there is an alarm for high conductivity, we want that alarm...
Replies
5
Views
1,263
Looking at a Micrologix 1000 1761-L32AWA, I tried to connect using the 1761-CBL-PM02 through a Serial to USB converter (This setup was used...
Replies
2
Views
991
Hello All I am trying to convert a ML1000 program for use in a ML1400. I didn't create the original program & documentation is non existent...
Replies
14
Views
4,419
Hey Folks, I have a customer with an older machine that is controlled with a MicroLogix 1000. The machine just quit working. The power light is...
Replies
22
Views
10,597
Back
Top Bottom