Biomedical User Group Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

ECG_Viewer bad start

Tell me please, my VI has long-standing problem, it does not run the first time. Perhaps this is due to the initialization of Com-port. And when you click on the Start button, I put the item on the very first Probe conductor, which is the name of the port and it says "Not Executed". And sometimes I can run with the VI 10-second time

0 Kudos
Message 1 of 4
(3,952 Views)

I don't have all your subVIs, but it appears your problem is initialization of your front panel variables.  Given what I see, the loop will run and read all your booleans before they are initialized.  The writes to the property nodes take about three orders of magnitude longer than reading from the terminals.  To fix this in a clean fashion, do the following:

  1. Replace all the property nodes with local variables.
  2. Create a flat sequence with two frames (very big frames).
  3. Drag all your initialization code into the first frame
  4. Drag all the rest of your code into the second

This will cure the race condition between setting the variables and reading them in the loop (they currently are in parallel and the first read in the loop is far faster).

Note that setting a Value property requires the front panel to be fully updated before they return.  The property nodes will also execute in a serial fashion, since they all use the UI thread, making your initialization very slow compared to setting up the queues, serial port, and loop.  Using local variables will speed things up tremendously, but the race condition will remain.  You still want to use the flat sequence.

Better yet, read up on state machines and rewrite your code to use one.  An initialization state would solve this problem in a far cleaner fashion.

0 Kudos
Message 2 of 4
(3,226 Views)

to test the VI, I removed all the extra out of it. And put in the Flat Sequence Structure initialization block COM-port. But I still run VI not every time and the error number -1073807253. Why can it be?

0 Kudos
Message 3 of 4
(3,226 Views)

It is something in what DFGray recommend. But his suggestion of doing this Realy DFGray...Doh!

  1. Replace all the property nodes with local variables.
  2. Create a flat sequence with two frames (very big frames).
  3. Drag all your initialization code into the first frame
  4. Drag all the rest of your code into the second

First let us keep things simple. I find your setup with the queus somewhat dodgy. And the Labview serial port driver will do this for you. You just have to set up large enough buffer and add some safety space on top on that. And always read faster than it fills up. Also then working with serial ports. You set it once, keep it open as long as needed and then close it. As I have done it. And by wireing as I have done. You will have the correct order of things. And also note how I take care of the race condition for the preset values. The big While loop will only execute. Then data from all wires has arrived. And in the same way. The serial port colse will not execute before data has been delivered on exit from the big loop. In Labview this is named data float and it is very important  Take a look at my VI. Things are fixed up somewhat. But as I am note sure how your data is sent from to the serial port. It will not work. It is therfore very important that you tell us. Down to the last detail. The data structure. Used in the the serial transmision protocol.



Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 4 of 4
(3,226 Views)