LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Double frequency loop with elapsed time.

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?

0 Kudos
Message 1 of 11
(3,303 Views)
It would be best if you posted your VI so we can better understand what you are trying to do and figure out where the problem may be.
0 Kudos
Message 2 of 11
(3,276 Views)
0 Kudos
Message 3 of 11
(3,256 Views)
I've been working som moore and made the following observations: This VI is a subVI to another program. The stop button is an in signal from the main program. I probed both boolean wires when the program was running and it shows that not only does the subVI:s stop-control not change it's value, but the value in stop button wire in the main program is also probed as false. While the loop is running, the status of the stop button in the main program is obviously not checked. Can something be done about this?
0 Kudos
Message 4 of 11
(3,247 Views)

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.

Message 5 of 11
(3,239 Views)

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).

Message 6 of 11
(3,237 Views)
This is the main program. Are there any subVI:s missing?
0 Kudos
Message 7 of 11
(3,218 Views)
If the other one does not work, try this one instead.
0 Kudos
Message 8 of 11
(3,217 Views)
I've never used property nodes before. Should I place a property node in the subVI and have it refer to the main VI? How would I do that?
0 Kudos
Message 9 of 11
(3,205 Views)

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.

0 Kudos
Message 10 of 11
(3,198 Views)