unlatch all bits and outputs in RSLogix 500?

RH68

Member
Join Date
Jun 2008
Location
Maryland
Posts
21
Hi all, long time lurker but first time poster. I am working on changing the control system of a machine I built from Direct Logix to AB Micrologix1000.

I have emulated the stage programming I did on the DL PLC by using latching/unlatching bits as opposed to JMP like I used on the DL to go from stage to stage.

My question is this: is there an easy way to set up a stop monitoring stage at the end of the program that will unlatch all bits and outputs if the stop button is pressed? Currently, I have a bunch of unlatch instructions in parallel to reset all of the bits and outputs if stop is pressed. Is there a single command I can use to unlatch all of the bits and another command to unlatch all of the outputs? I think I need to use a "masked Move" but I don't quite understand how to use it. When I press the stop button, I want to turn off all outputs, get out of all stages, and go back to stage 1(startup stage). If I used the masked move, my source and destination would be the same bit. Is this ok? Thanks, RH68
 
If all the bits/outputs are within a word you can use MOV to move a value of zero to unlatch all the bit at once. If you want to unlatch a selected bits, say all the odd bits you can use MVM to do that, the source is still zero but, set a value of the mask as all odd bits as '1'. The destination will be affected where the mask is 1, rest unchanged.

----------------
MVM
0000000000000000 [source]

0101010101010101 [Mask]

B3:0 [Destination]

----------------
You can use a word address or a hexadecimal value as mask!

If you want to unlatch a set of consecutive words you should use a FLL command to move zero to the first destination word and set how many words you want to unlatch.

Regards
_______
 
I have emulated the stage programming I did on the DL PLC by using latching/unlatching bits as opposed to JMP like I used on the DL to go from stage to stage.

that "go from stage to stage" part makes me wonder ... is there any way that you can post your .RSS file? ... if I understand what you're saying, then yes - there is a way to "emulate" stage programming in ladder logic ...

but ...

many (most?) of the methods used to do that end up being much more complicated and convoluted than just "regular old" ladder logic ...

anyway - welcome to the forum ...

PS ... I'm actually a great fan of DL Stage Programming ...
 
As mentioned the MOV can move a source (zero for example) to a destination. A CLR can do this as well.

If you want to clear out consecutive words then try the File-Fill FLL instruction. Like a MOV you specify a source (zero) and a starting destination. Then a length for the number of consecutive words to fill (clear).

OG
 
Ron Beaufort said:
that "go from stage to stage" part makes me wonder ... is there any way that you can post your .RSS file? ... if I understand what you're saying, then yes - there is a way to "emulate" stage programming in ladder logic ...

but ...

many (most?) of the methods used to do that end up being much more complicated and convoluted than just "regular old" ladder logic ...

anyway - welcome to the forum ...

PS ... I'm actually a great fan of DL Stage Programming ...
Ron, please see the attached file. I basically left the Stop PB rung blank. This is the last rung and where I want to reset all of the bits and unlatch all of the outputs. Thanks.
 
Greetings RH68 ...



I don’t have time to dig all the way through it, but actually the basic idea of what you’ve written should work fine ...



using the “active stage marker” bits (example: B3/2) is a perfectly acceptable way to keep track of what point in the cycle is “active” ... this is the same effect that the “stages” perform automatically in DL’s stage programming ...



just a quick “artistic” note ... instead of hanging one branch under another “stair step” style, try right-clicking on the lower left corner of the first branch - and then select “extend branch down” ... you can do that multiple times and get nice smooth branches - if you’re “into” that sort of thing ...



also - going just a little bit deeper ... consider what might happen if some of your field device outputs happen to be ON - and the power to the PLC system fails ... since you’re using OTL instructions (latches) to bring on the field devices, there is a chance that the outputs could come right back on again once the power is subsequently restored ... (in “tech talk” the Latches are “retentive” - meaning that they retain their ON status when the system is power cycled) ...



now in some systems, that’s a highly desirable feature - but in others it could be very dangerous ...



there are different ways of handling this - including just “unlatching” all of your “latched” bits when the processor first goes into the Run mode ... look at bit S:1/15 as a “processor just came on” condition - and follow through on the same “unlatching” idea that you’re working on for your master stop button ...



you’re probably already aware of that concept - but I thought that I’d mention it just in case ...



another idea (for future reference) is to use ONLY “internal” bits (example: B3/33) within the normal flow of the program - rather than mixing in any real-world “output” bits (example: O:0/9) ... one internal bit near the top of a program (example: B3/31) might be documented “Stage 1 needs Run Relay” ... another internal bit near the end of the program (example: B3/35) might be documented “Stage 5 needs Run Relay” ...



now then ...



after the end of all of the normal “stage flow” programming we might have a separate “output” section - where each “real-world” device is controlled on a separate rung by an OTE instruction ...



and so an XIC for B3/31 would bring on the Run Relay during “Stage 1” ... OR - in a branch on the same rung - an XIC for B3/35 could also bring it on during “Stage 5” ...



the idea is to keep the “flow” of the individual stages separate from each other - and to keep “Stage 1” logic from getting “mixed in” with “Stage 5” logic ... keeping the real-world outputs out of the “flow” completely is usually the cleanest way to pull this off - especially when the same real-world output must be turned ON in two or more “stages” ...



all of this is just “while we’re at it” type stuff ... it looks like you’ve done a pretty good job of programming ... the suggestions from my distinguished colleagues should answer your questions about how to “turn off” the bits you were asking about ...



wish I had time to play more ... good luck with your project ...
 
RH,

I have added a way to Unlatch your stage relays and your Outputs on Rung 21 of the attached revision. As Chavek and others mentioned, you can use a MVM (Masked Move) instruction, but it must have an Address Source, not a constant. I used N7:0, first clearing (CLR) it to 0. To do this reset neatly, you need to put your relays in consecutive numerical order, using specific memory word(s). I did a Search & Replace and moved all your stage relays to B3:0, so that only a reset of the first 9 bits of B3:0 is necessary. It appears you are using Outputs O:0/0 to O:0/11, so my second MVM sets the first 12 bits of Word O:0 to 0.

I cleaned it up some for you, using branch extensions (saves memory) instead of the branch-inside-branches that you used. I noticed that the Pin Extend resets, beginning on Rung 16, will not work correctly. If the Pin Counter C5:0 = 4, you are Extending Pins 1 through 4, but you only reset Pin 4. I changed this to reset all up to and including Pin 4.

You should consider eliminating some of the Latches, only using Latching relays for your Stages. This would prevent having to do all the Unlatches at the end of each step.

Best Regards,
Lancie
 
Lancie and Ron, thanks so much for your help. This is much more than I ever expected. Lancie, I think I found an error in my program...I need to add B3:0/14 (Arm Pins) Examine if closed to Rung 15 in the program rewritten by you. This way the cycle counter only increments when the carriage is on its way back up. Do you agree?

I need to add some more logic that controls another set of pins that let trays into the machine. Basically, once a tray is in position, this pin (O:0/8)extends to hold back the rest of the trays until the tray in progress has gone thru the dispenser and tripped the tray clear photoeye. It will use the tray detected photoeye signal and tray clear photoeye signal to know whether to extend or retract. Any help with adding this logic would be great.

Lancie, will adding this logic affect the Masked Moves you added to the stop logic? I don't understand the syntax so I am not sure if adding some more Bits will require changing the Masked Move mask. Can you explain what exactly the 01FFh and 0FFh mean and the numbers underneath mean? Thanks again for your help.
 
RH68 said:
Can you explain what exactly the 01FFh and 0FFh mean and the numbers underneath mean?

Open your calculator (MS) and change the view to scientific

Click on Hex and type 01FFh then click on decimal (also binary) this will show you the value of the mask, the first part Lancie1 is setting all 0's to the register, next loading a value of 511 dec (also known as 01FFh or 111111) and also on the next part, its setting the output word..

Not sure what he is doing, but I think I am correct with the MMV

The destination is in binary

These are all the same number... if you look at the MMV help file it will explain it also

BIN.JPG

DEC.JPG

HEX.JPG
 
RH68 said:
Lancie, will adding this logic affect the Masked Moves you added to the stop logic? I don't understand the syntax so I am not sure if adding some more Bits will require changing the Masked Move mask. Can you explain what exactly the 01FFh and 0FFh mean and the numbers underneath mean? Thanks again for your help.

01FFh is the number 01FF in hex format it represents the bit pattern 0000 0001 1111 1111. I assume that this is teh bit pattern used in the Masked Move Instruction , only the first nine bits (those corresponding to a 1) will be affected by the MVM instruction. Similarily 0FFh would represent 0000 1111 1111 but this is only showing 12 bits and not 16.
 
Lancie, will adding this logic affect the Masked Moves you added to the stop logic?
It will affect the MVM only if you need to reset more than the first 12 bits of Output word O:0, or if the new O:0/8 DOES NOT need resetting. (Even though O:0.8 was not in your program, actually I saw O:0/8 in your list of Addresses, thought it was something you were going to add later, and included it also in the reset operation).

I don't understand the syntax so I am not sure if adding some more Bits will require changing the Masked Move mask.
Genius and Dua explained the Mask part of the MVM instruction already. When you insert the MVM, you have the option of typing in the Mask word in Binary bits, Hexadecimal, or Decimal. Binary is usually easiest, because you know which bits you want to be "active". Just set those to 1 and all others to 0, and that creates the Binary word 0000 1111 1111 1111, which in this case equals 0FFFh (Hexadecimal) or 4095 Decimal. Once entered, RSLogix converts the number to Hex. Try it yourself by: re-enter the binary number, then right-click on the Rung Number, select "Verify Rung".

Source is the address of the data you want to move.

Mask is the address of the mask through which the instruction moves data. The mask can also be a hexadecimal value. You can enter the value in binary, decimal, or hexadecimal. RSLogix500 will make any necessary conversion and display the hexadecimal value. Click here for an example showing how to enter the Mask value using hexadecimal, binary, or decimal values.

Destination is the address where the instruction moves the data.
The mask acts like a filter for the destination. The pattern of characters in the mask determines which bits will be passed from the source to the destination, and which bits will be masked. Only bits in the mask that are set (1) will pass data to the destination.
For example:

If before the move, the destination address contains 0000000000000000
and the bit values in the source word are - 1111000011110000
and the bit setting in the mask address are - 0000000011111111
after the move, the destination will contain - 0000000011110000

Note in the example, that the bits in the mask that are reset do not pass data to the destination. Only the bits in the mask that are set to (1) pass source data.
Rockwell Software 2000
 
Lancie, I think I found an error in my program...I need to add B3:0/14 (Arm Pins) Examine if closed to Rung 15 in the program rewritten by you. This way the cycle counter only increments when the carriage is on its way back up. Do you agree?
I think you do need the Arm Pins XIC on Rung 15, but the new address for the Arm Pins latch is B3:0/7. (Remember, I renumbered your latching addresses to get them all into one word in consecutive locations, so that the MVM Reset would be simple.)
 
Last edited:
I need to add some more logic that controls another set of pins that let trays into the machine. Basically, once a tray is in position, this pin (O:0/8)extends to hold back the rest of the trays until the tray in progress has gone thru the dispenser and tripped the tray clear photoeye. It will use the tray detected photoeye signal and tray clear photoeye signal to know whether to extend or retract. Any help with adding this logic would be great.
I would be happy to help with this, but I am not going to have any time to work on it for the next week. Maybe some of the others can walk you through this step. I suggest adding another Stage (step) and a Step relay for this step.
 

Similar Topics

Hello All, Can someone see what I did wrong here. My "PA" bit never seems to get energized despite hitting "SOFTKEY7" many times
Replies
5
Views
765
Hi guys, I have a question regarding studio 5000 with processor 1769-L33ER V33.011 and Factorytalk View SE V12. I have an home-made pop-up...
Replies
3
Views
1,606
I'm troubleshooting a machine for a customer right now, and the output that is not working needs this bit to go high to activate the coil. But the...
Replies
36
Views
13,615
I am trying to convert an old PLC5 program. I have several instances in the unlatch instruction where they give a B file on top of the unlatch...
Replies
9
Views
2,045
Hi everyone. First time poster here. I am very new to PLC programming (my programming background is more in computers). I have a question with...
Replies
12
Views
3,325
Back
Top Bottom