From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I speed up inp/outp over the parallel port?

Environment: LabWindows/CVI 6.0, Windows NT

We're downloading a BUNCH of data to a custom hardware device over the parallel port using inp()/outp(). The download loop, which looks something like:
for (i=0; i<2400000; i++) {
Byte = Data[i];
outp(Byte);
}
takes 30 seconds to execute. If we comment out the "outp" line, the loop is instantaneous, so all that 30 seconds is tied up in the call to outp(). The same piece of code, when compiled with Microsoft C++ using a piece of freeware called GiveIO for low-level access, takes 4 seconds to execute.

Is there any way to speed up the native CVI outp() function?

We can't use VISA, because our hardware can't be configured the way VI
SA would like.

Any suggestions greatly appreciated. I'm afraid we may have to ditch CVI and try to use GiveIO instead, if we can't resolve this speed issue.

Thanks,
-Michelle
0 Kudos
Message 1 of 3
(3,017 Views)
CVI is not designed as a low-level driver development environment. It is designed for application development. We do provide a general purpose device driver that lets you read and write to registers with inp and outp, but it is generic code and not optimized for specific types of devices such as parallel. If you need high efficiency in low-level communication you should write your own device driver in Visual C++ with Microsoft's DDK then call that driver from CVI.

FYI, I ran a test of this on my machine (2.4 million outp writes to LPT1) and it took 13.5 seconds for me. I'm on WinXP though.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 2 of 3
(3,017 Views)
Let me clarify a little more about what I mean when I say CVI's low-level driver is generic and not optimized. The inp and outp functions work with 1 byte of information. In your case you want to write 2.4 MB of info. CVI, in writing 1 byte at a time, causes 2.4 million kernel transitions which takes the extra time you are seeing. Writing the buffer in 1 kernel transition is what is improving the time in C++ tool you are using.

If you want I could send you another possible solution that will work for you from CVI. If so, send an e-mail to our support via www.ni.com/ask and I will reply to you directly.

Best Regards,

Chris Matthews
National Instruments
0 Kudos
Message 3 of 3
(3,017 Views)