04-17-2009 06:01 AM
I'm making VI which is supposed to communicate with an external device. It should send a message every 60s and recieve a message every 256ms. In order to accomplish this I've tried to make a loop in which two events reoccur at different frequencies. First I did this as the included test program blink2.vi where two LED:s flash at different frequencies. Then I made the also included library ET_loop.llb where messages are sent and recieved based on the time synchronization principle of blink2.
It almost works, but it has some problems. First of all, the stop button, which works perfectly in blink2.vi doesn't work at all. Second, I get an error in two lower wire reading:
Error -1073807252 occurred at VISA Read in SerialPortControl.vi->readVISA2.vi->Getstring2.vi->ET_loop.vi->Main_control_sequence.vi
Possible reason(s):
VISA: (Hex 0xBFFF006C) An overrun error occurred during transfer. A character was not read from the hardware before the next character arrived.
Any suggestions?
04-18-2009 09:54 PM
04-21-2009 03:20 AM
04-21-2009 08:24 AM
04-21-2009 10:30 AM
Well, if you want to read the state of a button in the main program, you need to wire a control reference to the subVI and read it's value with a property node. If you just call the subVI, it will only get the value of the button at the time it is called. Dataflow!
Instead of spinning the loop at full bore and consuming all CPU, you should maybe use a timed loop at 256ms rate, eliminating all that lower "elapsed" mess and case structure. Now you only need to check for the 60s elapsed. Also, you don't need to wire the boolean wire across the case structures, since the output is independent of the case.
04-21-2009 10:34 AM
Tzench wrote:
While the loop is running, the status of the stop button in the main program is obviously not checked.
Most likely, the stop button is set to latch action, meaning it resets to false as soon as it is read once by the code. I suspect that your main loop also does not have a wait, so the button will only turn TRUE for a nanosecond and you won't see it. It could also be that your main VI is stalled until the subVI completes, in which case probing does not do anything useful.
For further help, please attach all the missing parts (main VI, missing subVIs).
04-22-2009 02:37 AM
04-22-2009 02:40 AM
04-22-2009 04:46 AM
04-22-2009 08:10 AM
I've tried to introduce a property node. The "open VI reference" says it has the calling VI as it's default value, but I cant get any values out of it.