Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Timebase for DAQmx Create Timing Source

Hello:
I would like to time a timed loop using the 20 MHz timebase of the PCI-6115. For this, I have tried to use DAQmx Create Timing Source/ Frequency. This Vi detects three terminals of the PCI-6115: Ctr0, Ctr1 and Freq. I guess that the counters Ctr0 and Ctr1 use the another timebase available in the PCI-6115 (100 KHz) because if the frequency of DAQmx Create Timing Source/ Frequency is set up to 100 Khz, it works (although from around a frequency of 8 KHz overwrite error appears; i don't know if this happens because the timed loop counts by itself the pulses of the timing signal). However, if the frequency is higher than 100 Khz the PC target hangs up and consequently i have to reset the PC target.
Considering that the counters use the 100 KHz timebase, I have tried to use the 20 MHz timebase by the TimeBaseSource Property of DaqmxTiming with no success (I have obtained this information from NiDaqmx help). For this, I have modified  DAQmx Create Timing Source/ Frequency by adding this property, but error -200477 ("Specified operation cannot be performed when there are no devices in the task.")and -200452  ("Specified property is not supported by the device or is not applicable to the task") appear depending on the place of the property in the VI. The thing is that actually the device is not an input parameter of DAQmx Create Timing Source.
 
I have tried as well to use other instances of DAQmx Create Timing Source with no success.
 
Thank you in advance. Any help is welcome!!!
0 Kudos
Message 1 of 5
(4,707 Views)
Couple of things
 
#1.  You can change your timebase source.  I tried this in the same VI and had no problems.  Make sure that when you test it you test it from the overall app and not the create timing source VI itself.  Or...make sure you counters match
 
#2.   I still am unclear why you want to use the 20Mhz timing source.  If this is on an RT system 8khz seems slow, but 100Khz sounds like you might be running into the problem where your computer is not able to catch up with the number of interrupts being generated "interrupt storm" and therefore it looks like it hangs.  If this is actually a Windows system then that is definitely what is happening.
 
StuartG
0 Kudos
Message 2 of 5
(4,705 Views)

Hello:

 

Thank you very much for responding.

 

As you have guessed, I use LabView RT with a PC target.

I was actually executing the VI from the “main”. I do not know why, but I have tried again the DAQmx Create Timing Source/ Frequency with the new timebase (you can see in the attached doc called CTS) and the previous errors do not appear anymore.

 

Anyway, the reason why I want to change the timebase is to try to resolve one problem: I’m developing a real time application that acquires and processes two signals. The processing is performed to provide a diagnostic. The main specification of my application is that the maximum time interval admitted between one sample in “the real world” and the diagnostic emission is 15 ms (this is the real deadline).

The signals are acquired by the NI-6115 at 5 MSamples per second and channel. This DAQ only supports buffered acquisition.

In order to achieve the real deadline what I do is to limit the input buffer by the VI Configure Input Buffer to 80000 samples per channel, which is equivalent to 15 ms (in other words, the real deadline).

 

The acquisition and processing is performed in a Timed Loop with a period of 10 ms. The key thing is that the complete application is able to execute for various minutes (10 minutes, even more time) without overwriting error (error -200279). Independently of the execution time (2 seconds, 2 minutes, 5 minutes, 10 minutes…), the available samples per channel in the last iteration of execution range from 4000 to 5000 samples. Since the timed loop period (10 ms) plus available samples per channel (the worst case is 5000 samples, that is 1 ms of samples) yields 11 ms (10ms+1ms=11ms) I understand that the deadline is fulfilled because 11ms<15ms.

 

However, when I quantify the number of Finished Lates, it varies depending on the clock used in the timed loop. Since the acquisition uses the 20MHz timebase available in the Ni-6115, I wanted to check if the Finished lates are related to the bad synchronization of the clocks or something like that. But, after using the 20 MHz timebase in the timed loop (In DAQmx Create Timing Source/ Frequency: Frequency=100 Hz; and the period of the timed loop=1tick), all the iterations still yield Finished Lates. I have registered the “expected end” and “actual and” of only 200 iterations of the timed loop and, due to a delay in the second iteration, all the iterations appear delayed 1 tick (10 ms). I have tried to process nothing (only read the samples) in the first and the second iteration, but the delay still appears, this time in iteration 4 (I have attached a Vi with the arrays corresponding to Expected end, actual end…).

 

Maybe I’m misunderstanding everything and all this is stupid thinking.

 

Thank you very much for your help.
Download All
0 Kudos
Message 3 of 5
(4,686 Views)

It would be much easier if you could provide a simple version of the test you are running so I can see what is actually going on here and maybe be able to provide suggestions.

 

StuartG

0 Kudos
Message 4 of 5
(4,669 Views)
Hi there,
 
Sorry about the delay in responding. I've been construnting a simpler version of the test I'm doing. It is a non-sense example but is enough to cause finished lates in the way I explained in my last reply. I think that my problem is related to the synchronization of the timebases. Is it posible to use the timebase of the DAQ for the whole real-time project, and not only for the acquisition and the timed loop?
 
Thank you again!
0 Kudos
Message 5 of 5
(4,509 Views)