LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

rt timing loop pci 7041/6040 E

Hello. I'm working with a RT board, model PCI-7041/6040 E. The specifications sheet indicates that it can run a single PID loop at up to 26 kHz, but Labview 7.1 programming only allows cycle times with a maximum resolution of 1 milisecond (1 kHz). I have tried to create faster loops using either a normal loop structure with the RT "Wait until next multiple" (with resolution of microseconds) and "Timed loop" structure with a fast clock (there is a 1MHz clock, but it is disabled), but It seems to be impossible to reach this frequency. I've read that maybe I need to use a hardware clock from the DAQ daughterboard 6040 but:
a) A general purpose counter is necessary to do this. This board has only two counters and I need both counters to per
form other functions.
b) I think there must be an easier way to reach the required frequency, without using hardware timing.
How can I build a loop with a cycle time smaller than one milisecond? Should it be possible to use the board internal clock or something like that? Is there anybody who could send me an example?
Thank you.
0 Kudos
Message 1 of 5
(3,453 Views)
This question from 2/26/04 appears to be similar.

To answer your questions,
a) A general purpose counter or the analog input (AI) scanclock can be used to control your loop timing. You must use a counter or the AI scanclock to achieve 26 kHz.
b) the installed RT Timing and RT Control examples show many techniques for controlling your loop period, including an example for each of the above two methods.

Let me know if you have any questions after you check 'em out.
0 Kudos
Message 2 of 5
(3,453 Views)
Thanks for your help. Your comment has been quite useful. I have taken some ideas but I'm afraid I didn't explain my problem properly (in fact, I have just read my comment and I'm sure I didn't). Let me try it again.
I need a fast loop (cycle time smaller than 1 ms), but not for PID control (using analog input and outputs and their associated VIs). I need it to count pulses from two encoders (using both general purpose counters), compare these counts with a number and generate a trigger signal (one of the digital outputs, I supose) if both counts are bigger than the mentioned number.
I have been analyzing the provided example ("One Channel PID Control.vi") and I think this structure is not suitable for my system, because it's based on counters, not
in analog signals, and I don't know if I can use the AI and AO config VIs to perform loop timing in this case. Is there any similar structure or VIs for counters? In addition, this example uses Traditional NI-DAQ VIs and, as I'm using a PCI-7041 with Labview 7.1, this board is managed with NI-DAQmx, so I don't exactly know how to use this example.
I can't use general purpose counters to perform hardware timing as I have seen in a few examples because I need both counters to count pulses from encoders, so this solution is unavaliable too.
Do you know how can I build the described system?
Thanks!
0 Kudos
Message 3 of 5
(3,453 Views)
Even though you don't need to perform analog input, you can still utilize the AI Scanclock to time your loop (in both Traditional DAQ and DAQmx) at sub-millisecond periods.

If you weren't using both counters, you could time your loop with a counter as an alternative to the AI Scanclock. Not really helpful here, but worth mentioning for other readers.

In Traditional DAQ, the One Channel PID Control example is not based on general purpose counters. It is based on the AI Scanclock.

For a DAQmx example of how to control your loop timing with the AI Scanclock, check out \LabVIEW 7.1\examples\DAQmx\Control\Control.llb\PID Control-Advanced.vi. This example does basically the same thing as the other example I pointed you to. A
gain, this example is not based on general purpose counters, which means you can incorporate your counter code into this example.

Also, I reread you first post and noticed you had trouble using the Timed Loop. In addition to the above options for timing your loop, you can use DAQmx Create Timing Source in conjunction with a Timed Loop to control loop timing at sub-millisecond periods. Check out \LabVIEW 7.1\vi.lib\DAQmx\create\timing.llb\DAQmx Create Timing Source (Digital Change Detection).vi for an example of how to do this.
0 Kudos
Message 4 of 5
(3,453 Views)
Correction:

Last sentence should have read, "Check out \LabVIEW 7.1\examples\DAQmx\Control\Event Response.llb\Event Response.vi for an example of how to do this."
0 Kudos
Message 5 of 5
(3,453 Views)