LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Temporising for loop based on board clock with daqmx

Hello,

 

I am trying to synchronise a for loop with an on board clock. 

The shared ni is juste a partition of the global algorithm, other tasks are temporised by the clock and I need the actions to be simultaneous with each iterations of the for loop.

I don't want to temporise the task but the loop.

This for loop read some channels and change the value to write based on real digital sensors values.

 

BaptisteGuilleux_0-1743669474079.png

Is it possible ?

 

test_gene_bench.vi is the main

Read_config_switch.vi loads the configuration associating the channels (read/write channels)

Read_Write_Switches.vi read and write the switches if asked in "LI modificateur"

0 Kudos
Message 1 of 7
(224 Views)

Hi Baptiste,

 


@Baptiste.Guilleux wrote:

I am trying to synchronise a for loop with an on board clock. 

 

Is it possible ?


The FOR loop doesn't know about any Onboard clocks, it just follows DATAFLOW mechanisms…

 

In which way do you want to "synchronise" the FOR loop with your DAQ hardware? What are the (specific) requirements?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 7
(221 Views)

Hello GerdW,

 

Thank you very much for your answer.

 

I am developing a test bench for a control software associated with a motorized bench on which there are physical switches. Depending on my test scenarios, I must either simulate the outputs that are sent to the software via the CompactDAQ or use the actual values provided by the switches on the motorized bench.

 

During scenario execution, different inputs are read and different outputs are generated, so all actions in a single step must be simultaneous (or as close to it as possible).

 

The aim of our for loop is to read a value from one channel and write it to another. The iterations of this loop must be timed to be synchronized with the other actions.

 

I can't time out the task because I'm sending the samples one by one, so I'm looking to time out the loop (if possible).

 

Don't hesitate to ask if you need more information.

 

Best Regards,

Baptiste

0 Kudos
Message 3 of 7
(212 Views)

@Baptiste.Guilleux wrote:

During scenario execution, different inputs are read and different outputs are generated, so all actions in a single step must be simultaneous (or as close to it as possible).

 

The aim of our for loop is to read a value from one channel and write it to another. The iterations of this loop must be timed to be synchronized with the other actions.

 

I can't time out the task because I'm sending the samples one by one, so I'm looking to time out the loop (if possible).


The Application Case 1 in NI-DAQmx Hardware-Timed Single Point Lateness Checking is what you are looking for. Unfortunately, HWTSP mode is not supported on cDAQ. To use that mode, you need cRIO-904x/905x. See DAQ Devices with Hardware-Timed Single Point Sampling Mode Support

 

If you only have cDAQ, the workaround would be the example in Application Case 5, using software-timed I/O. You should expect some degree of jitter.

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
Message 4 of 7
(142 Views)

Hi ZYOng,

 

Thanks for these informations.

 

We are using only the cDAQ in our case. I'm not sure to understand well the solution in Application case 5. In our case, its means that we have to adjust our whole program to use the Software-timed I/O, or can we juste use it for this loop ?

 

Best regards,

Baptiste

0 Kudos
Message 5 of 7
(114 Views)

There is only one loop in your program that you want to control the timing. So yea, you can try replacing the for loop with the timed loop. However, you should know that the timed loop still has significant jitter in Windows.

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
0 Kudos
Message 6 of 7
(68 Views)

Yes, in the file I shared there is only one loop to test individualy all my functions, but I want to synchronise this loop with others.

 

I don't understand something, with the cDAQ I can use the on board clock to temporise tasks, however this doesn't work to synchronise my for loop ?

 

0 Kudos
Message 7 of 7
(60 Views)