Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

how do I synchronize analog and counter inputs with multiple x-series devices

Solved!
Go to solution

Perhaps I am getting close, thanks to your help.

 

On all of my tasks, I now have specified PXI1Slot2/PXIe_Clk100 as the reference clock, with 100e6 as the rate, before setting any other channel properties (as required according to the kb you pointed out earlier). When I start any of my counter tasks, they yield a -200077 error complaining that the rate must be either 10e6 or 20e6. If I change the RefClk.Rate on just the encoder and counter tasks to 10e6, I get an -89136 error. If I chage the RefClock.Rate to 10e6 on all my tasks, I get -200744 error: "Specified reference clock rate does not match the specified reference clock source", in addition to -89136 errors.

0 Kudos
Message 11 of 15
(2,472 Views)

"/PXI1Slot2/PXIe_Clk100" is a terminal on PXI1Slot2.  For the other devices, you would specify "/<DeviceName>/PXIe_Clk100" or just "PXIe_Clk100".

 

To access the terminal on PXI1Slot2 from the other devices, the signal would be routed across the PXI_Trig bus.  A reference clock sourced from the PXI_Trig bus can only be 10 or 20 MHz according to the specs.  Even though the signal is originating from PXIe_Clk100, the way you are referencing it is causing it to be routed through the PXI_Trig bus which makes the 100 MHz frequency no longer valid.

 

 

This is more what I had in mind (although I don't have the actual hardware handy to validate it on):

 

Counter_AI_Sync.png

 

EDIT:  You'll want to explicitly set the reference clock source on the AI task's reference clock to "PXIe_Clk100" if you want it to also work in the case when the AI task only has one device.

 

 

Best Regards,

John Passiak
0 Kudos
Message 12 of 15
(2,467 Views)

Thanks John. That VI was instructive. It looks like you have to set the reference rate along with the source in the second DAQmx timing call, otherwise I get an error complaining about the rate being zero. So I set the reference clock rate explicitly.

 

How did you post that code snippet inline? (And how did you extract it in labview?)

 

I was attempted to refactor things into subvis and typedefs. Hopefully it doesn't make it more difficult to understand. The main file is example_main. The first subvi in that file is the analog config, the second is the counters, the third is the encoders. As you see in the analog subvi, I explicitly set the PXIe_Clk100 src, and then pass that along to configure the counter and encoder tasks. I still get an error complaining that the rate would have to be 10 or 20e6, even though I changed the source to be "PXIe_Clk100" instead of "/PXI1Slot2/PXIe_Clk100".

 

I really appreciate you help and patience. I'm sorry its taking me so long to understand.

0 Kudos
Message 13 of 15
(2,459 Views)
Solution
Accepted by topic author dsdale24

Did the example work as I posted it?

 

Yours is different in that it is setting the reference clock of the first task and then reading back the value from the property node to pass to the counters. This ends up putting the device prefix back into the terminal name and you're back to setting the terminal to "/PXI1Slot2/PXIe_Clk100".

 

Untitled 6 Block Diagram _2014-05-02_12-51-23.png

 

 

To insert a snippet into your post to this forum, there's an insert/edit image button above where you type your message:

 

Reply to Message - Discussion Forums - Google Chrome_2014-05-02_12-55-33.png

 

To create a snippet from LabVIEW go to Edit >> Create VI Snippet from Selection:

 

example_main.png

 

To copy the code into LabVIEW, just drag the image onto your block diagram.  It doesn't work directly from a web browser without plugins though so you will probably have to save the image to your local computer first.

 

 

Best Regards,

John Passiak
Message 14 of 15
(2,454 Views)

Thanks John. I did not realize it was possible to import code by pasting a photo into a block diagram. I was not able to run the code as you posted, but I changed my own code as you suggested, and it is finally working.

 

So for the record, here are the basic outlines of the solution:

 

main.png

 

here is subvi 1, configuring the analog signals:

 

analog_input_config.png

 

 

subvi 2, configuring counters:

 

counter_input_config.png

 

and subvi 3, configuring encoders:

 

encoder_input_config.png

 

 

Really, thanks again for all your help. Its not much, but if you send me an email with your address, I'll send you a check for $50.

0 Kudos
Message 15 of 15
(2,448 Views)