11-04-2021 04:30 AM - edited 11-04-2021 04:33 AM
Hi. I need to trigger an event from one loop and handle it in two other loops.
I firstly used a 1 item target scope FIFO but it seems that it's efficient only from 1 loop to 1 loop.
When several receivers loops, the event is not detected by all of them everytime. few loops sometimes ignore it.
I have the feeling this is related to the fact that the moment of the "FIFO write" from the emitter loop triggers outside the "FIFO read" timeout execution from receiver loops.
Do you know what I can do? 🙂 thanks in advance
11-04-2021 05:02 AM
It depends almost entirely on the details.
Is this a trigger, or more like a status? Is it a one shot, or more like a queue?
Sometimes a simple local does the trick. A Boolean can be set in one loop, and read in n loops. An integer can also be nice, one loop can increase it, and the other loops can compare their internal count to the goal.
Memory can also work nicely. One loop fills values it at a pointer, the other loops read the value own pointer, up until the latest update. Care should be taken to make the memory large enough so the read can keep up with the writes.
11-04-2021 06:15 AM
I presume you're not using Single-cycle timed loops?
11-04-2021 07:41 AM
wiebe@CARYA a écrit :
It depends almost entirely on the details.
Is this a trigger, or more like a status? Is it a one shot, or more like a queue?
Sometimes a simple local does the trick. A Boolean can be set in one loop, and read in n loops. An integer can also be nice, one loop can increase it, and the other loops can compare their internal count to the goal.
Memory can also work nicely. One loop fills values it at a pointer, the other loops read the value own pointer, up until the latest update. Care should be taken to make the memory large enough so the read can keep up with the writes.
-This is a trigger for the detection of an electrical arc during the test. one shot
-the triggering loop is doing the measurements
-the receiver loops are managing the supplies
when the measuring loop detects an electrical arc, it passes the event to the receiver loops that put the supplies down depending on the type of arc occured during the event. (this value is passed within the FIFO)
all the loops are 100khz (physical limitation due to NI modules)
I tried to pass data with register items, but I faced values losses, since the value stays only during 1 loop
11-04-2021 07:42 AM
@Intaris a écrit :
I presume you're not using Single-cycle timed loops?
no, only normal loop, with a 100khz rate generated by a "wait ticks" function
11-04-2021 12:33 PM
The 'event' could be an integer value.
Conceptually, like this:
This is an U64, so you won't run out of values anytime soon.
For the value, you have options.
A scalar value, read by local. There are risks, the value can be changed before reading, so you can trigger multiple events, and only get to use the last value.
You can put the values in a memory block, say 256 values large. Then set the value to the address "integer AND 255". Read the values from the loops counter AND 255.
These are just some ideas. All kind of combinations are possible. One FIFO for two readers won't work though.