Hello,
I am currently using the NI PCI-6220 M SERIES DAQ ( Item# 779065-01 ) with the BNC-2110 ACCESSORY ( Item# 777643-01 ). I am programming in Visual Studios 2005 with C# and the newest ( I believe ) version of Measurement Studios. I posted a somewhat similiar question previously, but I have revised what I am asking because I do not think I made it clear in the last post. What I need to do is write digital output in precise intervals of 1/40000 of a second. In between those outputs though, I need to update the data that will be outputted( the digital lines that will be turned on or off). So I need to:
1.) Do a digital write to Port 0 for all lines.
2.) Update the data array used for the write
3.) Output again at EXACTLY 1/40000 of a second from the time the write from step 1 was completed.
4.) Repeat.
What I am trying to do is:
1.)Turn on Port0/Line0
2.)Update data array to also turn on Port0/Line1 on next write
3.)Do the next digital write exactly 1/40000 of a second from when we turned on Port0/Line0, so that Port0/Line0 and Port0/Line1 are now both on.
4.) Continue doing these steps, turning on another line after each iteration untill all lines are on.
5.)After all lines are on, turn off Port0/Line7 1/40000 of a second from when it was turned on
6.) Update data array to turn off Port0/Line6 as well on next write.
7.) Do the next digital write exactly 1/40000 of a second from when we turned off Port0/Line7, so now Port0/Line7 and Port0/Line 6 are both off.
8.)Continue doing these steps, stepping down through the lines and turning each off untill all are off.
9.)Start over at step 1.
Now I know how to do a digital write. I have figured out how to make a digital pulse that will generate a pulse based on a static (predefined) set of data. It seems to me that all methods of synchronizing the digital output with AI or AO, or sharing the AI or AO sample clock only allow you to use a static (predefined) data set for output. I need to be able to output a dynamic (updateable) data set in precise intervals. Is it even possible to do this on a PC using your board? It seems the only way to even update the data would be to use a callback function, but that will not allow for precise timing since you hand control over to the PC's processor which is subject to interrupts and processor scheduling. If the callback function was to be called twice (or more) and update the data multiple times before the next digital write then the data will be totally off. Or vice versa, if the callback function is not called fast enough before the next digital write then the data will be off as well. Do you have any ideas for a way around this? I am at a dead end. I don't suppose I can use some sort of software lock (like a semaphore) that uses the onboard counter for a locking mechanism could I? I suppose that might work in the callback function to possibly (but probably not) solve the problem of multiple updates before the next output, but it wont solve the problem of multiple outputs before the next update. Any ideas would be very helpful. Thank you so much.