LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Resetting a Case structure

Solved!
Go to solution
I am writing a VI that reads in a signal to a comparator and sends the
output
to a
case structure.

The ides behind the project is EMG (monitoring muscle active/inactive
times).

The case structure is as follows:
If 1: count up and if count reaches 10 then green LED on (represents muscle

active)

If 0: count up and if count reaches 10 then red LED on (represents muscle
inactive
and should be exercised.)

My question is how could I reset the case structure to start again: i.e, If

Case=0
and the inactive time reaches 10 and RED LED comes on, I want this to then
turn
off
and put the count back to 0 if it switches to Case=1.
(The idea is that this RED LED is representing a Vibrate motor (which I
will
output
to using DAQ) . The motor will switch on as the RED LED does to indicate to
a
user
muscle should be exercised but I do not want the motor to be on constant, I

need it
to turn off when the muscle is exercised and then restart the count again)

I probably haven't explained this very well but I have attached my VI.

Any help would be appreciated
0 Kudos
Message 1 of 6
(4,017 Views)

PinkLady4128 wrote:

The case structure is as follows:
If 1: count up and if count reaches 10 then green LED on (represents muscle
active)

If 0: count up and if count reaches 10 then red LED on (represents muscle
inactive and should be exercised.)
 What is the count interval? How is the count increment triggered (time ie: every second?)
My question is how could I reset the case structure to start again: i.e, If
Case=0 and the inactive time reaches 10 and RED LED comes on, I want this to then
turn off and put the count back to 0 if it switches to Case=1.
Do you want the reset to occur automatically and restart?  Do you want someone to notice the RED LED?  If it resets, do you want to start again but keep the RED LED on which also indicates that the motor is running?
(The idea is that this RED LED is representing a Vibrate motor (which I
will output to using DAQ). The motor will switch on as the RED LED does to indicate to
a user muscle should be exercised but I do not want the motor to be on constant, I
need it to turn off when the muscle is exercised and then restart the count again)
So while it is counting, if there is muscle movement detected, do you want the motor to stop and the RED LED to turn off?
I probably haven't explained this very well but I have attached my VI.

You forgot to attach your VI

 

0 Kudos
Message 2 of 6
(4,004 Views)

What is the count interval? How is the count increment triggered (time ie: every second?)

 

The count is just an increment loop in the case structure. When this reaches 10 the LED comes on. But at the minute it just continues to increment all the time, never goes back to  0, and LED is on.

 

 Do you want the reset to occur automatically and restart?  Do you want someone to notice the RED LED?  If it resets, do you want to start again but keep the RED LED on which also indicates that the motor is running? 

I want the reset to occur when the signal goes back to a high state ( i.e. there is muscle movement)

 

 So while it is counting, if there is muscle movement detected, do you want the motor to stop and the RED LED to turn off?

 This is exactly what I want if high signal detected stop the motor and LED  (The RED LED is just a representation of when the motor is on or off (they are synchronous) - I plan to output the LED state to a DAQ to give voltage to the motor) 

But I would also like for the count to go back to 0 when this happens..So that if the signal goes low again it begins to count again and motor vibrates when low for 10 counts again.

 

 I have attached the VI this time 

 

Thanks for your time. 

0 Kudos
Message 3 of 6
(3,991 Views)

PinkLady4128 wrote:

What is the count interval? How is the count increment triggered (time ie: every second?)

 

The count is just an increment loop in the case structure. When this reaches 10 the LED comes on. But at the minute it just continues to increment all the time, never goes back to  0, and LED is on.



What I meant was how long between each count.  If each loop iteration takes 10 ms to complete, do you want the LED to light up in 100ms?  

I haven't looked at the code yet, and will look at it soon.

0 Kudos
Message 4 of 6
(3,971 Views)
The count is 1000ms. So the LED lights after 10 seconds.
0 Kudos
Message 5 of 6
(3,967 Views)
Solution
Accepted by topic author PinkLady4128

Have a look at the attached VI.  I saved it to LV8.0 because I didn't know which version you were using.

 

Hope I understood what you were looking for.

 

 

Message 6 of 6
(3,951 Views)