Store order of outputs

drumcode

Member
Join Date
Aug 2015
Location
Odense SV
Posts
4
Hi everyone

I am facing a small problem, how can I, in the example given below, store which output that has been set first, second and third. ? Outputs will be randomly set and therefore i need to know which order they have been set in. Do you have any idea how to do that? I thought of some kind of "first in, first out" thing. but how to do this in ladder?
PLC that is in use is a almost 30year old Idec FA-2J but still runs perfect.



----|XX|------|M200|-----------------(M540)set

----|T2|-------------------------------(M540)reset



----|XX|------|M201|-----------------(M541)set

----|T5|-------------------------------(M541)reset



----|XX|------|M202|-----------------(M542)set

----|T8|-------------------------------(M542)reset
 
Last edited:
Hi drumcode,

can you run a 24hr timer in parallel to the process? If so
lathch bits, store the actual time when they were latched and then compare the times.
Don't know this PLC you are using but I would try this way.
 
I don't know how to implement a FIFO in your PLC but I would try having each output load a value into the FIFO. For example. M540 loads a 1 into the FIFO, M541 a 2, M542 a 3. Then you could look at the order from there. It wouldn't tell you what times it all occurred but it would certainly tell you an order.
 
Simple counter?

As each bit goes true, trigger the counter and move the count value into a register that correlates with the bit?

Bit 1 = True, Count = 1, Bit1Count = Count (1)
Bit 2 = True, Count = 2, Bit2Count = Count (2)
Bit 3 = True, Count = 3, Bit3Count = Count (3)

------------------------------------------------

Of course this is only half the battle, how they get reset and set again could bugger it all up.
 
Just implement a fifo...if your plc doesn't have that instruction built in then brute force it. Select a contiguous set of memory integers. Each time any of your three outputs go high shift all the integers either through individual moves or a fifo instruction. On individual it would be something like

Move word 9 to word 10
Move word 8 to word 9
Move word 7 to word 8
...
Move word 1 to Word 2

After those rungs have three rungs that look at the outputs individually and move a value 1 to 3 into word 1:

Output 1 Move 1 into Word 1
Output 2 Move 2 into word 1
Output 3 Move 3 into word 1
 
come on guys. no one????

Not everyone here is on 24 hours a day. You post late in the day expecting immediate response is are unreasonable.

But on to your question.
How can you store the outputs that are set first second and third?

You could store the order in 3 integers.
The first integer would store which output came on first.
The second integer would store which output came on second.
The third integer would store which output came on third.

How to do it?

when all bits are off, set the integers to zero.
When the first bit comes on (the first integer is zero), set the first integer to a value corresponding to the bit that came on.
When a second bit comes on (the first integer is not zero, but the second is zero), set the second integer to a value corresponding to the second bit that came on. Likewise to the third.

As a general guide when figuring out how to program something like this, think about what you would tell a young child to do so that they could accomplish the task for you. Once the steps are simple and defined, it shouldn't be hard to write the code. It might not be the most compact code, but it should be easy to follow.
 

Similar Topics

I'm running into a problem when trying to use the RSLinx Backup Restore Utility where it throws an error when it tries to restore a backup. The...
Replies
6
Views
544
Hi y'all I have a KTP400 connected to a s7-1200. Now i have on my screen the encoder value which comes from my SEW movitrac. under there I have...
Replies
2
Views
381
This was asked in another forum and taken down due to being a 'backdoor', but this has useful info that might be useful to someone in a pinch. I'm...
Replies
6
Views
604
Hello all, I'm using a 5069-L330ER in a project and I need to essentially capture some data that will be shown as a trend on a screen. The data...
Replies
9
Views
959
Hi all, I am working with an IO link sensor (measuring current across motor)and need to read in and store the sensor values for 5 seconds, then...
Replies
13
Views
1,200
Back
Top Bottom