LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Count Up/Down timer

Hi, 

I'm new to labview and i would greatly appreciate any help that can be given. 

 

Basically, i'm trying to create a countdown/countup timer using elapsed timer vi. However, after using shift registers to store my previous data, i came to realized that my output of the timer isnt the exact speed of 0.05s per iteration and that affects my overall data. I have a feeling is the wrong usage of shift registers but i'm not sure what or how to fix this. Any help please? 

 

Lost student,

Jarrold 

0 Kudos
Message 1 of 6
(2,744 Views)

As a new programmer, you are making some beginner mistakes.

  • Your second true and false cases seems identical except for the indicators. All shared code belongs outside the case.
  • Your first case structure only needs a single output tunnel.
  • Your overuse of local variables blurs the distinction between control and indicator functionality. For example, why is "timetorun 2" an indicator?
  • Why are the radiobutton terminals not connected to the code? (no need for local variables)
  • Inserting a TRUE into a boolean array with 6 elements using an enum with 15 possible states makes no sense. Can you explain?
  • Converting an array to a cluster with 3 elements just to index out the second and third element is not how it's done.
  • Why are the two "array of boolean" controls? Is the user supposed to operate them during the run? Why?
  • "OR FALSE" just returns the other input unchanged. Same function as a plain wire.
  • There seems to be some state variable enums, but not used in a reasonable way.
  • In what sense does the iteration duration affect your overall data? 
  • Please explain how the VI is supposed to be operated and what behavior you expect based on control changes.
  • Adding or subtracting the value of "elapsed time" seems incorrect.
  • Why are your controls scattered so far apart on the front panel?
0 Kudos
Message 2 of 6
(2,723 Views)

Hi AltenBach,

 

i’m developing a syringe pump control that infuse/withdraw liquid according to the timer values. 

 

The missing variables and controls or enum and suchs are all a part of a state machine on a bigger vi. I took the codes out because apparently my timer is faulty as the adding and subtracting parts are incorrect as you mentioned and it would be too much to explain if I attached the whole VI in. 

 

I would just just like the timer to be able to countup (false case) and countdown (true case) from where the timer value was before changing cases and vice versa.

The other parts of the code is written to indicate the volume left in the syringe after each infuse/withdraw

0 Kudos
Message 3 of 6
(2,720 Views)

@Jarrold wrote:

 

I would just just like the timer to be able to countup (false case) and countdown (true case) from where the timer value was before changing cases and vice versa.


In real life time always goes forward. You can either indicate the elapsed time for the current state or the remaining time for the current state, but that should not depend on the direction. What should happen if the time has elapsed? What should happen if the syringe is empty or at the full mark?

Shouldn't there be at least three states (infuse, withdraw, pause)?

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

@altenbach

 

Thank you for tying to help and i do know that there should be conditions that stop the pump when it’s in its different states but I could not seem to find a way to pass down the data of the remaining time during the changing of states. That’s why I tried to create a timer that goes up/down depending on the direction to ensure that the total volume in the pump should change accordingly depending on what’s the remaining volume during the changes from state to state. This timer would be just a part of my “mathematical equation” to help me calculate what’s the actual remaining volume in the pump itself and not the actual calculation for elapsed time because I do have that in placed already. 

 

Is is there a simpler way to save the remaining time and pass it to the next each time I change from infuse/withdraw state and vice versa? 

0 Kudos
Message 5 of 6
(2,706 Views)

The shift register should contain the current syringe volume (from empty to full) and should increment or decrement according to the the direction at a rate that depends on the speed and time.

0 Kudos
Message 6 of 6
(2,655 Views)