LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Call Library Function execution rate when calling FT_Read from D2XX.dll

Solved!
Go to solution

Greetings, dear NI community!

 

Although my problem might appear very specific and hard-to-reproduce, the tight situation I am in leaves me no other options.

I work with FTDI's FT232R USB UART chip and I'm having trouble with the FT_Read_Byte_Data.vi from D2XX function library for LabVIEW.

This VI uses Call Library Function node to call FT_Read() from d2xx.dll.

 

Now the problem is, when I call FT_Read() in a timed loop, the data acquisition rate appears to be strangely slow:

the Call Library Function node takes about 100ms to call FT_Read(), and my VI needs to fetch data every 1 ms.

Is there a solution to this?

 

Looking forward to your reply,
Michael

0 Kudos
Message 1 of 7
(4,303 Views)

Hi Mefodius,

 

It sounds like this may be an issue with the dll that you're calling itself. Does this issue happen with any other dlls on your machine? Have you been able to use this dll on another machine without experiencing the decrease in performance? We want to try to identify whether or not it's an issue with your program or the dll itself, so if you could elaborate a little bit more it would be very helpful. I look forward to hearing back from you.

 

Paul M

National Instruments | Applications Engineer | www.ni.com/support
0 Kudos
Message 2 of 7
(4,257 Views)

To proof-test the case, I used an example piece of code (I don't have a link to the corresponding thread though),

which reads a 'Labview Rocks' string from Nationalinstruments.dll in a loop with an execution time of less than 1ms.

 

I've also run my VI on a 'blank' system under WinXP with the same ~100-ish ms results.

The most interesting part is that I have an old version of the project written on Delphi, which uses the exact same dll

to call the same function succsessfully with a <1ms execution rate. I assume there's something wrong with my own code,

but I fail to identify the problem.

 

 I've tried diagram-disabling the Call Library Function node; doing that yields an 1-2ms loop execution rate,

which is much closer to needed. Then I thought it's the Format Into File node that's slowing the loop down,

so I've tried to use Call Library Function without processing the function's output data, but it didn't make any difference.

 

Hence, this thread. The only reason I'm not attaching a screenshot of my code right now is that the loop containing

the problem is really long, dimension-wise, so I'm not sure which part of it to include.

 

I hope this clarifies; looking forward to a reply.

0 Kudos
Message 3 of 7
(4,229 Views)

There is either something wrong with your code or the dll. I would recomend downloading the latest version.

 

A block diagram should be no larger than 1 screen. Attach the actual VI or create a snippet. Can't debug an ordinary image.

0 Kudos
Message 4 of 7
(4,223 Views)

Here's the piece of code:

Download All
0 Kudos
Message 5 of 7
(4,209 Views)
Solution
Accepted by topic author Mefodius

You are not checking to see how many bytes are actually available. Are you sure it's just not waiting until the number of bytes you specify is actually available?

Message 6 of 7
(4,196 Views)

This is it. The loop was waiting for the device to pass all the requested data, the dimension of which was way too oversized. Thank you very much!

0 Kudos
Message 7 of 7
(4,174 Views)