LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event Structure

Solved!
Go to solution

Hello everybody,

 

I just started LabView last week and I am trying to do an ECG. What I would like to do is 3 buttons, one to add a patient and save data in a subVI, an other to stop and the last one to see the signal. I use an event structure to do it. The signal is a row of numbers that I read with "Read meas File".
My problem is that when I click on the button to see the signal it displays only one point and I would like to see the signal moving like a real ECG.

 

Thanks

 

0 Kudos
Message 1 of 14
(3,341 Views)

PierBJX,

 

As you are new, please attach code when asking questions such as this.  You're more likely to get help, and the help will be more useful.

 

-DR2

0 Kudos
Message 2 of 14
(3,329 Views)

DR2,

 

I modify the message to add the .vi, is this code you talk about ?

0 Kudos
Message 3 of 14
(3,324 Views)

Yep, that's it! 😉

 

Looking at your code, I believe that a Simple State Machine would suit you well here. You wouldn't be pigeon-holed into packing your code into an Event Structure. I am going on the assumption that you don't need to continuously display data.

0 Kudos
Message 4 of 14
(3,292 Views)
Solution
Accepted by topic author PierBJX

Some more comments:

  • The entire blue code at the bottom could be replaced by a single "quotient&Remainder" function. You should divide by the actual length of the data, not by a constant.
  • There is a +1 primitive.
  • A wait inside a value changed event makes little sense.
  • You could use the timeout event to scroll the data.
  • Yes, keep the data in a shift register and add event cases to load new data and to save data. What exactly do you want to save? (you already have all the data in a file!).
  • Please never maximize the front panel and diagram window to the screen. That's very annoying!
  • To get better help, you should also attach a typical data file.

 

0 Kudos
Message 5 of 14
(3,265 Views)

altenbach wrote:
  • Please never maximize the front panel and diagram window to the screen. That's very annoying!

Sorry for derailing a little here, but I've seen you say this a few times (and I also find opening full screen VIs annoying - hitting Ctrl-T by accident invariably a frustration) but does LabVIEW save VIs differently when full screen? I can imagine if they're saved by position/bounds (i.e. pixels) even a high-res screen being loaded on a low-res screen would be problematic. Is full-screen different?


GCentral
0 Kudos
Message 6 of 14
(3,257 Views)

What do you mean by using a simple state machine ?

I am already using a event structure, no ?

0 Kudos
Message 7 of 14
(3,237 Views)

altenbach thanks for your help very useful!

- What do you mean when you write "There is a +1 primitive" ?
- Instead of using the timeout event to scroll data maybe I could use a loop with a stop, what do you think ?

- I just want to create a new user and I am using a subVI and it works, I just a simple create file, write file and close file.

- Sorry for the screen 😕

- I attached the typical data file

 

thanks

0 Kudos
Message 8 of 14
(3,230 Views)

PierBJX wrote:

- What do you mean when you write "There is a +1 primitive" ?


 

See here. No need for a "+" and a "1" diagram constant.

 

 


PierBJX wrote:

- Instead of using the timeout event to scroll data maybe I could use a loop with a stop, what do you think ?

 


Don't over-complicate things! You already have a while loop to spin the code. That's all you need. If you trap the code in an inner while loop, you interfere with the event structure. And if you use a parallel while loop, you need to implement inter-loop communication and such.

 

I'll have a look at your file....

0 Kudos
Message 9 of 14
(3,222 Views)

Here's a simple illustration of using Q&R and the timeout event. Pressing the ECG button starts or stops the chart.

 

(In the final program you should have an event to load new data and then keep it in a shift register, of course)

 

 

0 Kudos
Message 10 of 14
(3,215 Views)