09-08-2010 01:31 PM
I have a problem with Reading a digital IO port with measurement studio and DAQmx. I have upgraded to 9.2 and it appears to improve the problem; but it is not fixed. I am still getting a error popup that contains no information that will crash my code at a random time several hours after the start. If I remove the sleep(350) from the code, the error pops up after a couple seconds -- so it is repeatable. I have attempted to read a specific channel, I have attempted to use an event, I have attempted almost every possible configuration to get around this problem. This is an error in the DAQmx library.
I need some help with this. Our system runs for days at a time...
Task task_DIOAcquire = new Task("DIO_acquire_task");
task_DIOAcquire.DIChannels.CreateChannel("NF_6733_Right/port0",
"AcquireChannel",
ChannelLineGrouping.OneChannelForAllLines);
DigitalSingleChannelReader channel_DIOAcquire = new DigitalSingleChannelReader(task_DIOAcquire.Stream);
while (!flag_ContactClosure)
{
dio_state = channel_DIOAcquire.ReadSingleSamplePortUInt32();
if (flag_DIO_low) // wait for the trigger to go low before checking if it goes high
{
// if we get the signal start acquiring.
if ((dio_state & 0x80) != 0)
{
flag_ContactClosure = true; // wait for the trigger to go low before checking if it goes high
}
}
else if ((dio_state & 0x80) == 0)
flag_DIO_low = true; // trigger went low, we can wait for it to go high now
Thread.Sleep(350);
}
09-09-2010 10:58 AM - edited 09-09-2010 11:06 AM
Hello
I would recommend running one of the shipping examples included with the NI-DAQmx driver to observe if this error still occurs (Windows Start>All Programs>National Instruments>NI-DAQ>Text Based Code Support>.NET Examples>Digital>Read Values). Also, in the event that the error is hardware related, check to see if you can control the device correctly in Measurement and Automation Explorer (MAX) Test Panels i.e. (MAX>Devices and Interfaces>right click on the DIO device> Test Panels). Troubleshooting a non descriptive error can be tricky, but If you can run these examples successfully, we can eliminate DAQmx as being an issue
Best regards,
Ali M
Applications Engineer
National Instruments
09-09-2010 11:24 AM
No, I got the code from the examples. I got this one and the single channel reader and the use of an interrupt which is not supported by my card all from the examples. I have the 6733. I, in fact, was able to get the error to repeat using your examples by removing the wait between reads. Overflow the buffer - or whatever - and watch the crash occur. The error returned is not trappable, system just crashes.
I have even put a 1 sec wait in the code to make sure the library can recover. Does not help. The error occurs at a random time between 2 and 12 hours later.
09-10-2010 02:08 PM
Can you control the NI 6733 in MAX/Test Panels?
Best regards,
Ali M
Applications Engineer
National Instruments
09-13-2010 04:37 PM
Yes, it self tests fine. The system works for hours at a time.
Just try removing the sleep from your example code. Watch the untrappable error pop up.
Thanks
bill
09-15-2010 05:13 PM - edited 09-15-2010 05:16 PM
Passing the sef test is good sign regarding the device status, I was mostly concerned about being able to run the device in MAX Test Panels. i.e. right click on the device under Devices and Interface>Test Panels. Also, which NI DAQmx example are you using?
Best regards,
Ali M
Applications Engineer
National Instruments
03-31-2011 05:16 PM
I solved the problem. Turns out I was reading on one thread and writing on another. Caused a random conflict. Error reporting is lacking even in your example code. System now runs for days at a time without trouble. Thanks for your help.