PXI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a pattern with a wait statement and an external trigger escape?

I would like to burst a pattern and then have that pattern keep executing until one of two conditions occur: 

(1) 10s pass

(2) an external trigger is received

 

I tried to achieve this with the following pattern (psudo-code):

1 default_timeset                reset_trigger(trig0)

2 -                              set_loop(reg0)

3 -                   loopA      set_loop(reg1)

4 -                   loopB      exit_loop_if(trig0, pointA)

5 -                              end_loop(loopB)

6 -                   pointA     exit_loop_if(trig0, pointB)

7 -                              end_loop(loopA)

8 -                   pointB     capture_start  

 

The point of the pattern is that it starts outputting a signal on some of the pins once it starts bursting and continues to output said signal while it waits for the trigger. If, for some reason the trigger is not received I do not want the pattern to be stuck so I calculate reg0 and reg1 based on the period of the default_timeset so the two loops should last approximately 10s. The conditional jump triggers in the PXIe-6570 Digital Pattern Instrument (DPI) are supposed to be latched so I'm not concerned about the trigger arriving on a vector that isn't 4 or 6. I used the "niDigital Configure Digital Edge Conditional Jump Trigger.vi" to route a PXI_trig signal to "conditionalJumpTrigger0".

If the trigger arrives the loop should end by the exit_loop_if opcode. Regardless of which exit_loop_if opcodes is triggered the loops should be finished correctly.

 

However, when executing this pattern I receive the error: -1074118630:

"The pattern sequencer overflowed the loop stack during a pattern burst. Overflow occurs when the sequencer executes more than 8 nested loops or when loops are improperly terminated without exit_loop or exit_loop_if opcodes. Reduce the number of nested loops in the loaded patterns and confirm that the loaded patterns use exit_loop and exit_loop_if opcodes to exit loops."

 

I tried changing vector 4 to jump to pointB instead of pointA, thinking that perhaps both loops were popped, but I received the same error.

I wait more than 1s before sending the command that triggers the event that sends the PXI_trig and I know this event occurs since I can follow the output of my instruments. I've also used the same trigger setup to start patterns with a trigger, so I know the DPI can receive and react to this PXI_trig.

In my current issue the pattern executes first and the start trigger is configured to None.

 

Is the trig0 which is used in the exit_loop_if opcode not a conditionalJumpTrigger?

Is there another error I'm not seeing?

0 Kudos
Message 1 of 3
(837 Views)

Why implement the 10s timeout in the pattern and not utilize the Burst pattern API's timeout option?

 

At the top level, your approach seems right. Try simplifying the implementation to just 1 loop and observe the behaviour.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 2 of 3
(815 Views)

Hi santo_13

 

Thanks for the reply!

I do not use the Burst Pattern.vi timeout option because of vector 8. I want to capture some data. The timeout on the pattern as a whole would return my system to a known state and allow me to continue working, but it would not provide me with any data. This would cause errors. Completely known and manageable errors, but still errors. I thought this approach would allow the pattern to finish gracefully and the data to be produced regardless of whether or not it is under the right circumstances. Furthermore, at the end of the pattern is a keep_alive opcode and I wasn't sure if a timeout would activate the keep_alive pattern.

 

I tried your suggestion: reduce to a single loop and it seems to work! Everything seems to execute correctly. Thanks for the suggestion!

 

However, at the speeds I'm operating at I would need to expand the pattern to have more than 400 non-nested loops in order to reach a timeout of 10s because a single loop is limited to 65535 iterations. When everything functions perfectly I don't have to worry about a 10s timeout because the trigger will arrive within milliseconds. However, under non-ideal conditions there may be an increase in this time and it will quite easily increase above the range of a single loop. That's why I used nested loops. I will keep the single-loop implementation for now, but it would be great if someone knew why the -1074118630 error code occurs or how to design a series of vectors that can achieve my goal in another fashion.

0 Kudos
Message 3 of 3
(806 Views)