10-29-2009 02:44 PM
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?
Solved! Go to Solution.
10-29-2009 02:48 PM
Too WEIRD!
Please post an image of the code.
Ben
10-29-2009 03:00 PM
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
10-29-2009 03:02 PM
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.
10-29-2009 03:03 PM
and yes, there is an error handler before the while loop
ill try to post it
10-29-2009 03:14 PM
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?
10-29-2009 03:14 PM
10-29-2009 03:26 PM
jimmyinct3 wrote:
ok, its posted.
Please attach the VI to a post rather than post a link to some server.
10-29-2009 03:27 PM - edited 10-29-2009 03:31 PM
vis cant be uploaded..
10-29-2009 04:16 PM - edited 10-29-2009 04:16 PM