From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

State Machine Timing - on Compact RIO

A time loop does one processes at a time. While a while loop do more than one process simultaneously (depending on if machine has multiple core processor)? 

 

 

Would it be possible to put a time loop inside a while loop on RT machine (specifically NI cRio-9076)?  I want to do a state machine with event based timing (see attachment) or state with periodic timing (see attachment).

 

 

The state that contains the time loop will be used to acquire data. Thus it will be deterministic.

 

 

Can someone tell me if this is doable?  

 

-Would I have to change the priority on the while loop to 100?

 

Thanks alot.  

 

*Also i am using the RIO Scan Interface 

Download All
0 Kudos
Message 1 of 9
(2,569 Views)

You can, but I don't know what you are trying to gain.

 

How many samples are you reading in that state?  How do you leave that state?  What are you doing with the data?  What does your state flow look like?


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 9
(2,554 Views)

I set the scan engine to 1ms.  So the time looped timing source will be set to, "Synchronize to Scan Engine." From my understanding this is the fastest the Rio scan interface can work before you have to go to FPGA programming.

 

 

ANSWER TO YOUR QUESTIONS:

The goal is to get x number of sample. Currently the number of sample is at 2000.  But will definitively become smaller fixed number in the future. I am still figuring out how small the sample number can be so I can still get accurate data. The accurate data will decide if my unit under test pass or fail.

 

Right now, I just run the time loop until number of sample is reached. (See attachment).

 

I have not created the state machine yet. I wanted to see if it was possible. I will leave the state when x number of sample are reached. The data will then be analyzed to see it if pass or fail.  The data will be sent to host machine so they can view it on a graph.    

  

 

*****

Another concern I have is I am only reading one channel now. But in the future, depending on setup, I could be reading anyway from 8 to 20 channels at the same time.  

0 Kudos
Message 3 of 9
(2,531 Views)

Personally, I would just have a separate loop just for reading from the FPGA.  You can configure that one to match the scan engine.  This way you can constantly read the data on the Windows machine even when you are not running a test.  I would use a queue to store the data to be sent over to the analysis/sate machine loop.  Probably use a global variable to conditionally enqueue the data.  Then in your state machine, you just check how many elements are in the queue.  Once you have enough, tell the acquisition to stop sending you data and flush the queue data.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 9
(2,522 Views)

Crossrulz,

 

I just started using controller couple weeks ago.   I am not sure on the best architect to use yet.

 

 

I only want to acquire data (from module 1) when a new unit under test is place on the line.  And I turn off digital output line to zero (module 2).

 

If I do it your way, wouldn’t I acquire data when there is nothing there? How would i know for sure it acquiring at the right time?  Can you send me screen shot of VI templete you are thinking of ? 

0 Kudos
Message 5 of 9
(2,518 Views)

I just threw this together really quick to get the idea across.  It is far from a good example.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 9
(2,510 Views)

Crossrulz,

 

Thanks!!! It help me see what you doing better..  Appererciate it.

 

 

and I got few more questions.

DAQmx functions are not allowed in the real time environment. But I think I could reply it will shared variable or something.

 

 

Since I am letting a deterministic loop (time loop) wait on non deterministic loop (while loop) wouldn’t that allow for jitter?  Which in turn, will make the scan data inaccurate?

0 Kudos
Message 7 of 9
(2,505 Views)

LIke I said, I threw it together really quick.  I just used to DAQmx Read to be some sort of read operation.  You will use the scan engine node instead.

 

The deterministic loop is not waiting for data from the undeterministic loop.  Just reading a variable is not going to add jitter, at least not any more than the timed loop will account for.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 9
(2,487 Views)

Crossrulz, 

 

Thanks alot.  Guess I am still a little confuse with what can go in deterministic loop and what cannot.  I thought I should alway avoid share resources in deterministic loop. 

 

 

I am out of the office for the next couple days. But I cannot wait to try it. 

 

 

Thanks allot... I really appreciate it.  

0 Kudos
Message 9 of 9
(2,458 Views)