Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmxSetDOTristate is slow

Hello Seth B.

 

Our PC is a P4 3GHz, 512MB RAM. Our traditional DAQ application runs on any PC from P3 500Mhz.

 

 

Can I upload our test application to you (both source and EXE)? So you can run the exact same application and send me your result?

 

Best regards, Tomas

0 Kudos
Message 11 of 15
(1,500 Views)

Hello Seth B,

 

I have put our source and a compiled EXE file on http://tomas.lugn.nu/DAQmxTest.zip

 

Please run it and give me the result. The output I get (on our 3GHz P4) is:

tick1=2413
tick2=421
tick3=420

Best regards,

Tomas

0 Kudos
Message 12 of 15
(1,482 Views)

Hello Tomas,

 

I apologize for the delay in responding.  I'll try to run this tomorrow and let you know what I see.

 

Regards,

 

Seth B.
Principal Test Engineer | National Instruments
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 13 of 15
(1,479 Views)

I've played around with your code and I've been able to reproduce what you are seeing.  It seems that the slow down is coming from trying to tristate a single line in a channel that has multiple lines.  Fortunately, I have a few recommendations that fixes the issue.  Which recommendation you pick will depend on your application.  Are you going to want to tristate all of the lines at once, or individual lines?

 

All Lines at Once

Change

iStatus = DAQmxSetDOTristate(g_DOtaskHandle[0],"Dev0/port0/line0",1);

 

To:

iStatus = DAQmxSetDOTristate(g_DOtaskHandle[0],"",1);

 

This will tristate all the lines in the port at once.

 

One Line at a Time

This is more complex, because we need to change how we are defining channels in the task.

 

First, the following change is needed:

iStatus = DAQmxCreateDOChan(g_DOtaskHandle[0],"Dev0/port0/line0:7","",DAQmx_Val_ChanPerLine);

 

This will create a separate channel for each line.

When you call  DAQmxSetDOTristate, you'll call it just like before.

 

The main change is that your DAQmxReadDigitalScalarU32 will need to become a DAQmxReadDigitalU32.  The Write function will change from DAQmxWriteDigitalScalarU32 to DAQmxWriteDigitalU32.

 

 

What these changes have basically done is go from having a task with one channel, made up of 8 digital lines to having a task with 8 channels, each with 1 digital line.

 

My testing here has shown an order of magnitude decrease in the tristate time if either of these changes is made.  The one you pick will depend on how your application needs to work.  I'm also going to file a corrective action request to have a developer investigate when there would be an order of magnitude increase in the time it takes to tristate a single line if you use the DAQmx_Val_ChanForAllLines argument.

 

Hope this helps!

 

Seth B.
Principal Test Engineer | National Instruments
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 14 of 15
(1,458 Views)

FYI, the Corrective Action Request # that I reported this under is CAR# 200219.

 

Regards,

Seth B.
Principal Test Engineer | National Instruments
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 15 of 15
(1,455 Views)