LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

delay when introducing serial port to main loop

Solved!
Go to solution

I have a main program which consists of a while loop that is acquiring data from NI DAQ cards each iteraction.

I want to have a serial port call which is only run when a new value is entered.

So i can use a shift register and compare the current value to the past value and then run the serial port when the value is changed.

But when i do this, the program takes about 6-7 seconds before any data is read on the plot after clicking the run button.

 

I have found that, even when the serial port is not doing anything, that delay is still there.

For example, i initialize the serial port outside of the while loop...

I drag the error and resouce wires for the serial port through the while loop, then do the visa close outside the while loop.

So NI shouldnt even be doing any type of computations regarding the serial port, yet, just the presence of the wire delays the onset of the program by a full 6 seconds.

As soon as the wire is removed, the program is back to functioning normally.

 

What is going on?

 

0 Kudos
Message 1 of 15
(3,504 Views)

Too WEIRD!

 

Please post an image of the code.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 15
(3,500 Views)

I can only make a guess without seeing the code, but maybe there is a timeout occurring when you initialize the port.

 

Try probing the error wire.

 

Are you handling errors in the vi?

 

 

steve

----------------------------------------------------------------------------------------------------------------
Founding (and only) member of AUITA - the Anti UI Thread Association.
----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 3 of 15
(3,490 Views)

 

yes, its related to errors

if i connect a terminal to the while loop, it generates an error

if i dont connect it, there is no error

i dunno.

0 Kudos
Message 4 of 15
(3,489 Views)

and yes, there is an error handler before the while loop

 

ill try to post it

0 Kudos
Message 5 of 15
(3,486 Views)

ok

i uploaded the vi as there is a sub vi. 

http://www.engr.uconn.edu/~jmacione/temp/test2.vi

 

so if you touch the while loop with the visa resource out and error wires

it will generate an error each time.

you will notice the chart will take 3-4 seconds to start updating, even if the message is removed.

if you remove the wire from touching the while loop, there is no error and it start instaneously.

 

it has to be related to compiling inside the while loop?

but the serial port is not even doing anything though, just touching it?

0 Kudos
Message 6 of 15
(3,474 Views)
ok, its posted.
0 Kudos
Message 7 of 15
(3,472 Views)

jimmyinct3 wrote:
ok, its posted.

Please attach the VI to a post rather than post a link to some server.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 8 of 15
(3,467 Views)

vis cant be uploaded..

 

 

Message Edited by jimmyinct3 on 10-29-2009 03:31 PM
0 Kudos
Message 9 of 15
(3,464 Views)
Because of some school policy or because the forum is preventing you somehow? I did take a look at your link however it is missing so many subVIs it didn't help.
Message Edited by Mark Yedinak on 10-29-2009 04:16 PM


Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 10 of 15
(3,439 Views)