LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Logic for "stop record" seems okay, but when implemented is sometimes not working

hi,

I have a labview program (I switched from 7.1 to 8.2 in the latter stages of programming)
aquiring data from a daq board and an image from a frame grabber.
While the program is running the data is displayed after some calculation and
the image is backgroundsubstracted and displayed.
This takes place in the main loop.

Inside the main loop there is a record loop, if it is active the images and data are written
to an .avi file.

There is a stop button to end the recording an launch the saving of .lvm file
for the data.

The logic is not simple and the program rather complex.

The stop button to end the recording is working most of the time, but sometimes
it fails for no apparent reason. Failing means here, that the button can be pushed and unpushed,
but this will not stop the recording. The programm than has to be aborted, as the "stop the program"
button is disabled while recording.

I attach the .vi file of a simple programm with only the loops and the logical opperations. This
programm seems to work, though.

I would be happy about some ideas for solving the problem, though?

miethe
0 Kudos
Message 1 of 5
(2,501 Views)
The logic in there is confusing, but otherwise it seems to work for me.  The only flaw I see is that sometimes the button presses are slow to respond.  This is because you don't have any wait functions in any of your loops, so they are running as fast as the computer will allow and eating up 100% of the processor time.  I would recommend putting in a 100 ms wait or wait until next ms function in you inner most loop.
Message 2 of 5
(2,477 Views)
Hi miethe,

in addition to raven's comment:
1) You can get rid of sequence structures when you trust the dataflow!
2) To 'save' the state of your program you can use shift registers instead of indicator and lots of local variables! In the example I replaced 'st record run' this way, you can do the same for 'record act'.
3) To simplify your logic: Instead of having two buttons 'Record' and 'stop record' you can make just one button: FALSE = no recording, TRUE= recording

Btw. your color scheme in the diagram is, hmm, 'interesting'. Having a pink while loop just next to a bluish one hurts my eyes Smiley Sad
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 5
(2,463 Views)
thanks to both of you,

putting in a wait function was what I was looking for to solve the problem. As the problem only did arise sometimes, time will show the improvement in the code.

commenting the comments:

1) In fact I  do not quite trust the data flow, but then there is a whole lot of more data flowing in the full programm.

2) good advise, thanks

3) I wanted to put record and record stop on one button in the beginning, but I couldn't figure out the logic for that. :o(

and yeah, the colour scheme is far from being optimized.

thanks again,
miethe
0 Kudos
Message 4 of 5
(2,451 Views)
Hi miethe,

1) In the example the dataflow is ensured by the error cluster. In your full vi this should be easier as you have an error cluster (wiring property nodes, DAQ, file writing) as well as wires for 'VISA resource' (DAQ) and file handle (AVI write). By feeding wires through case structures you set the dataflow!

3) Have you changed the mechanical action of this button to 'Switch when released'? Standard setting is 'Latch...'. You can do so by right-clicking the control.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 5
(2,444 Views)