11-11-2008 04:45 AM
Hi,
I hope u are doing fine. The code seems like what i would have expected. Can you please send me the full screen shot of the error that shows the full message in the error window.
Thanks,
11-11-2008 03:07 PM
Hello Colin,
You are very close with your synchronization technique for getting your DO and your AI to be synchronized. If you take a look at page 9 of the NI 6259 Specifications you will get a list of the supported triggers for each type of task you can use on this device. For example with a DO task, you can use the PFI or RTSI line as the sample clock for the device. There isn’t support for a start trigger. However, there is something we can do instead. If you look at Figure 7 of the example you sent, you will see a method of synchronization that uses the same sample clock between two tasks that are on separate devices. Both of these tasks are AI in the example, but you can make the slave task (the bottom task in the screen) a DO or DI task as needed. Since the 6259 does not support a start trigger for a DO task, you can remove this section of the code. In step four of the code we first start the slave and then the master. Since the slave uses an external sample clock, it will not update the output until a sample clock edge occurs. This will keep the devices synchronized because the master controls the clock of the slave directly. You will need a RTSI cable configured for the devices so you can share your sample clock.
On a side note, a DO task on a PCI-6259 supports correlated DIO. Basically this means that you can use a sample clock for your DIO with this device, but you will have to provide an external sample clock to do so.
11-12-2008 04:19 AM
Hi BrowningG,
Thanks for your advice, I've changed the DO sample clock source to that of the AO card, it does indeed seem to be synchronising!
There is one issue though, I'm trying to operate the AI card (6132) at 2.5 MS/s and the DO card (6259) at 10 MS/s. After looking at the DO it seems that the clock rate is actually 1/8th of what I asked. Is there a way of multiplying this up onboard the 6259 and using that for the sample clock?
Thanks and regards,
Colin
11-12-2008 04:33 AM
Okay, I'm not sure I understand this but I decreased the DO sample clock rate by a factor of 8 and it seems to have fixed this issue, not sure how that works!
Thanks again for the help 🙂
Colin
11-13-2008 02:49 PM
Hello Colin,
I should have been more clear in my previous post. An M Series device does not have the ability to divide down an internal timebase to generate an internal DO or DI sample clock. Check out the M Series User Manual for more information on how the hardware operates. As a result, you need to import an external signal to the device that can be used as a sample clock for the device. At this point the signal imported to the M Series device will be used as the sample clock, regardless of the rate you specify in your timing VI. The timing VI is also used to set the acquisition buffer size for both internal and external clocking. The KB: How Is the DAQmx Buffer Size Allocated for a Finite or Continuous Acquisition? provides information on how the buffer size is set.
It will be a little bit more complicated, but it is possible to get your DO and AI to synchronize at different rates. One idea would be to acquire both DO and AI at the same rate and then decimate your samples in software. This would keep your current solution, but would increase processing demand. Another idea would be to use a counter to generate the sample clock for the DO and use this sample clock as the master timebase for the AI. Then when you specify your sample rate for your AI, DAQmx will automatically divide your master timebase down to get your desired sample rate. If you look in the NI Example Finder (from LabVIEW click Help >> Find Examples) you can see all of the examples that ship with LabVIEW and your driver (in this case DAQmx). Some great ones to look at are in the path: Hardware Input and Output >> DAQmx. The Synchronization folder has some of the more common types of examples already written. For an example of how to use a counter as a sample clock, look at the example Multi-Function-Ctr Pulse Train Generation for AI Sample Clock.vi in the Multi-Function Section. In the Multi-Device section, look at Multi-Device Synch-Analog Input-Cont Acquisition.vi for an idea of how to replace the master timebase on S Series with an external clock.
11-14-2008 03:51 AM
Hi BrowningG,
Thanks for your advice, that does indeed seem to be what's happening. My slave DO card is using the master AI card timebase. I'm currently running the AI at 2.5 MS/s and want to run the DO at 10 MS/s. Is it possible to set the AI sample clock rate to 2.5 MS/s and multiply it up for the DO? Could I alternatively generate a 10 MS/s clock onboard the AI card, export that for DO and use a counter to divide down onboard for the AI task?
Am looking at those examples currently, they look promising! Will keep posted on my progress
Regards,
Colin