Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Sync 2 AO 2AI and Counter

Greeetings, I'm sure I've run up against a hardware limitation....

 

Trying to write a 2D array to two analog outputs (driving a stage location), while reading two analog inputs (X and Y actual position) and a counter input (intensity). What's at issue here is getting a trigger setup... 

 

I've mashed code from a sample that does a simultaneous write and read (AO and AI only, no counter), and that works fine, but when I try to add the counter.... no dice. Is there anyway to internally trigger one device off of the other (either with the read starting it all or the write)? I figured both would have an analog start trigger that would work but that's the way it's coded and no dice (same error using the AI start trigger from the 6210. Sorry for the error wires not being correct I was just trying to hunt down the problem and no code comments, I know it's not ready for prime time... not yet anyway.

 

Thanks,

 

TR

><><><><><><
Tommy R.
><><><><><><
0 Kudos
Message 1 of 7
(3,982 Views)

Hi,

 

Could you please let us know what is the specific error code and/or description you are encountering when your program fails? This may help shed some light on the specific reason for your issue. Thanks!

 

Daniel G.

Applications Engineering

National Instruments

http://www.ni.com/support

Daniel G.
Semiconductor & Wireless
National Instruments
0 Kudos
Message 2 of 7
(3,962 Views)

This is an example. It has to do with wanting to start everything on a trigger (internal). Can't seem to find the right combination (may be a hardware limitation with the 6210 I'm using?).

 

 

><><><><><><
Tommy R.
><><><><><><
0 Kudos
Message 3 of 7
(3,957 Views)

Unfortunately, that may be the case. I have tried it myself with simulated instruments and the error does not appear. In addition, some usb devices have very limited counter capabilities. We will keep checking on this for sure. In the meantime, check out this other thread which talks about the same issue you are having. You most likely already came accross this but just to make sure:

 

http://forums.ni.com/t5/Multifunction-DAQ/Error-200077-Frequency-and-Error-200452-Control-Loop-From-...

 

Daniel G.

Daniel G.
Semiconductor & Wireless
National Instruments
0 Kudos
Message 4 of 7
(3,944 Views)

Well I have tried the counter on the 6731 and get the same error.

 

You mention you have tried "it" on simulated devices. Is there some example code that you have (that I may have overlooked) that I might be able to try? I get the error on the real devices and on a different machine with only simulated devices (same ones in the project).

 

My code is built off of the "Multi-Function-Synch AI-AO.vi" and I've been trying to massage it without having to wire an external sync pulse from one device to the other. I ususally get Error -89125 indicating "no referenced trigger lines could be found between the devices in the route", but there seems to be a /Dev1/ai/StartTrigger (for the 6210) that shows up.

 

If I switch the two , it works, but in the I'm trying to add a counter measurement as well (both have counters, but I figured the hardware in the 6731 is better, but then I'd need to sync the AI reads with the Counter read, argh!).

><><><><><><
Tommy R.
><><><><><><
0 Kudos
Message 5 of 7
(3,940 Views)

There's a couple steps to take, but you should be able to get there from here with your boards.

 

1. The error is coming from the fact that you have a counter input task that is calling DAQmx Trigger.vi    For many years, counter input tasks could only be triggered using the DAQmx Trigger property node set for an "Arm Start" trigger.   I'm not 100% sure that remains true across all standard DAQ boards since I'm not very familiar with newer DAQ hw, but it had long been true across the whole product family.

   I reproduced your error with a simulated X-series and simulated M-series board, and got rid of it in both cases the same way(s).  The easy way is simply not to call DAQmx Trigger.vi at all, considering you're specifying "no trigger" anyway.  The other thing you can do is to replace the call to DAQmx Trigger.vi with a call to a DAQmx Trigger property node.  Then use the drop down menu to select "More-->Arm Start-->Trigger Type".  You can then right click to create a constant and set it to "None".  

   The only usefulness of this second approach is that in the future, you could set trigger type to "Digital Edge", specify the trigger source and edge, and end up with a counter input task which is triggered by a digital edge.   If you never need to trigger the counter task, just use the first approach and remove the call to DAQmx Trigger.vi.

 

2. The next error you're gonna get is from your Sample Clock config on your counter task.  The counter subsystem doesn't have it's own clock for sampling, you have to borrow one from elsewhere.  You should borrow from your AI or AO task by wiring the 'Source' input of your call to DAQmx Timing.

 

3. You'll probably want to do a similar thing with either your AI or AO task, and borrow the other's sample clock.  This is gonna be your best way to make sure all 3 tasks are sync'ed.  If they all sample off the same clock, *AND* you start the master task last, you're sure to acquire sync'ed data.

 

Below is a 2010 snippet of my example code with a simulated device.  Just change the IO constants to specify your board and you should be able to observe the different behaviors by selectively choosing which config code to enable & disable.

 

 

-Kevin P

 

 

counter clock and trigger.png

 

 

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 6 of 7
(3,888 Views)

Including "no trigger" on the counter task was my error, as I was manipulating the configuration iteratively to try and arrive at a solution. I had discovered the Trigger property node and had explored it as well.

 

The real issue is (since there's no shared routes between the devices), I have to externally route a Digital Trigger (say, the AI start) to a PFI pin (set as output) on one device to a PFI (set at input) pin on another to start everything together. Once again, since there's no shared routes, I'm doubting two separate devices could really sync well using their own sampling clocks (even if programmed at the same rate and triggered off a single channel wired externally, and perhaps a sync pulse wired externally as well).

 

I'm working on using a single PCI device with all the AO/AI/Count channels I need so I don't have to worry about sync being an issue.

 

Your #2 comment mentions that the counter subsystem doesn't have a clock, but I've seen examples that don't establish a clock from another subsytem when counting edges (even as simple as putting the read task in a timed loop). Could you elaborate?

 

I'm basically writing two channels of AO at 200 Hz, reading back two channels (AI) at 200 Hz and I'd like to count edges on a single counter channel at that rate as well (we're not using a gate on the PMT we're using).

 

So I'm arming the Counter and AO data (with a fixed array of data loaded and ready), with a trigger from the AI Read Trigger to sync them all.

><><><><><><
Tommy R.
><><><><><><
0 Kudos
Message 7 of 7
(3,853 Views)