Dan,
Thanks for posting to the NI Forums. To be able to ensure proper timing you will need to use hardware timing. In other words you will need to use the onboard clocks of the USB-6251 to control the timing between firing solenoids rather than using timed loops. The issue that you are experiencing is due to the fact that you cannot obtain absolute control over timing with Windows XP. Windows decides when to provide resources to LabVIEW and may not provide LabVIEW with resources in a timely manner. Obtaining this type of control in software generally requires a real-time operating system that provides deterministic behavior. Luckily, the USB-6251 has the capability to achieve what you are looking for without switching to an RT operating system. It will require using more of the features of the board but it is possible. Let me provide a recommendation as to how this could be done:
1. You will need program the USB-6251 to generate a clock to control timing. This can be done with the onboard counters. See the Gen Dig Pulse Train - Continuous example in the LabVIEW example finder (Help >> Find Examples, then Hardware Input and Output >> DAQmx >> Generating Digital Pulses) for how you could generate this clock. The clocks rate should be set such that it matches the smallest increment in the delay (in your case 5 ms or 200 Hz)
2. Next you will set up a timed digital output task that will use the generated clock as a sample clock. You will need to output on port 0, timed digital is only supported on this port on the USB-6251. You will write to the task the samples required for each solenoid for the entire sequence. You will then start the task.
Let me provide an example of what you would write to the channel:
Say for example you would like to fire the first solenoid then wait 5ms until the next solenoid fire and then wait 10 ms before the next one fires. The entire sequence will then last 15 ms. I set the clock to 5ms rate and choose rising edge for my sample clock. I would write the following before starting the task:
Channel 1: 1 1 1 1
Channel 2: 0 1 1 1
Channel 3: 0 0 0 1
On the first rising clock edge channel 1 will be activated. On the second rising edge 5ms later the second channel will be activated. On the 4th rising edge the 3rd channel will be activated.
Hopefully I have been able to clearly explain my recommendation. However, feel free to post back if you have additional questions about what I am suggesting. Let me know how it goes.
Regards,
Neil S.
Applications Engineer
National Instruments