Alternating Messages

donl517

Member
Join Date
Dec 2005
Location
Michigan
Posts
127
In the example I have several potential messages I want to call up in an HMI. The HMI uses DM to decide which message to display. The problem arises when multiple messages need to be displayed, the last active rung will always get precedence. I'm looking for a clean way to alternate between each active message. Lets say for example fault 1 and 3 are active, how would I set up a timer to display each message for 1.5 seconds and then start over from the beginning? Can it be done in a couple rungs of logic, or is it more complicated than that?

TIA,
Don

I should have mentioned I'm working with an Omron CP1L and a Panasonic GT05.

2-26-2012 7-01-05 AM.jpg
 

Attachments

  • Alternating Messages.zip
    1.5 KB · Views: 6
Last edited:
You beat me to it, I just edited my original post to include the PLC and HMI info. It is an Omron CP1L and Panasonic GT05.

Thanks,
Don
 
Your jpg attachment is too blurry to make out, and I don't have any Omron software, but there are many on this site who can open the file and offer help.
 
Well here is what I came up with. Seems to work fairly well, except the last message displayed, before the counter zeros out, is displayed for two timer counts. I'd be interested in any input.
 
Eric,

Would you mind posting some sample code when you get a chance. I read through post 22 and I got a little lost, an example might help.

TIA,
Don
 
I just dug out the project I 'thought' I used it on, but I thought wrong. Now I don't remember which machine I used it on... :oops:

Stick with ONLY post #22. Basically, you just want to assign each message to a bit within a word. I haven't touched an Omron in probably 15 years (though I did learn programming with Omron PLCs!). I forget how Omron does bit-of-word. Isn't it something like word 10 is bits 1000-1015?

Let's say messages 2, 7, and 9 need to be displayed. You word will now look like this: 0000001010000100 (Bits 2, 7, and 9 are ON). Let's call this the 'message word'.

Now you need a 'mask word'. This word will have a single '1' cycling through the word over and over.

0000000000000001
0000000000000010
0000000000000100
0000000000001000
.....
0100000000000000
1000000000000000
and repeat

You can use a SHIFT instruction. If the mask word equals zero, you load a '1' into bit zero, then shift repeatedly to move this '1' through the word. When it leaves the end, the word will equal zero again, so you automatically reload the '1' in bit 0 again. Note: I think Omron has a ROTATE instruction that will automatically 'recycle' the '1' bit back to 0 for you. Might make it easier?

You don't want any delay between messages, so 'shift' should occur every scan, but you want to pause it when it encounters one of the messages (so it can be displayed). This is where the AND comes into play. You want to AND the message word with the mask word. The result will only have a '1' in a bit location when the corresponding bits in the message AND mask words BOTH have a '1'.

Now let's see what happens each time the mask word bit moves...

Scan 1:
0000001010000100 Message Word
0000000000000001 Mask Word
------------------
0000000000000000 Result Word (nothing)

Scan 2:
0000001010000100 Message Word
0000000000000010 Mask Word
------------------
0000000000000000 Result Word (nothing)

Scan 3:
0000001010000100 Message Word
0000000000000100 Mask Word
------------------
0000000000000100 Result Word (Hey, we found something!)

The result word is not zero, so we need to display something. First we need to pause the mask word shift register. When the result word is not zero, we enable a timer. While this timer is running, we inhibit the shift register instruction, so the '1' in the mask word pauses at its current location.

Now we need to determine which message was found. We want the value of the bit that was found, so we use the ENCODE instruction (maybe DMPLX in Omron-speak?). The encoded value of 0000000000000100 is '2'. This will be used by your HMI to display message #2.

When the inhibit timer expires, the '1' bit in the mask word takes off running again, searching for the next '1' in the message word. In this example, it will find bit 7 next. The result word is again not zero, so we pause and decode that one, and so on...

Hopefully, this makes sense to you. Let me know if you need more details.

🍻

-Eric
 
Last edited:
Thank you Eric, that definitely cleared it up. When I get a few minutes, later this week, I'll see if I can't implement this, and post he results.

Don
 
Don,

we have a standard error message display routine that we use.
we have 2 for next loops in the plc logic to drive each active message.
loop 1 is for the fault word. - if its 0, goto next word. if its not, goto the bit loop.
loop 2 is the individual bits.
if a bit in the word is active we compute the bit number and put that number in an integer word.

that word controls a message display on the hmi.
pause the message display for a specified time and then goto the next bit.

For ab plc's,i do not use bit 15 since it is the sign bit and have had problems between the slc's and micro logix units.

the biggest file i have is 20 words @ 16 bits and most of them are used.

regards,
james
 

Similar Topics

Today I was making an online edit to a 5/40 Series E Rev K.2 with about 14% free memory. I was removing one branch in a large rung. Accept...
Replies
4
Views
3,167
I have 2 pumps not alternating at a lift station. When im at the panel and use the test switches to initiate the pumps,it alternates in the PLC...
Replies
22
Views
5,833
Hello I have been thinking in some way to operate 3 pumps in the same way (I have schneider modicon m340 PLC): -the pumps feed a tank. - As...
Replies
3
Views
1,876
Hi Everyone, trying to get an alternating output to work. Read through the forums on flip flop, toggle, etc. Found this site...
Replies
5
Views
4,217
Hi I'm kinda new at PLC programming sorta teaching myself. I need to alternate between two motors run one till satisfied the when it calls again...
Replies
2
Views
1,498
Back
Top Bottom