LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

labview first call alternative

I’m looking for an alternative to First Call in LabVIEW. I have a load cell and a target load I’m trying to reach, and I don’t want the timer to start until that load is reached. Right now, this code works as intended for the first loop, but as soon as I reset the boolean elsewhere for the next setpoint, First Call no longer works. I know there’s a way to do it with shift registers, but I can’t figure it out.

Download All
0 Kudos
Message 1 of 6
(190 Views)

Assuming the intent is to have "reset" be true at most once per run through of the loop, on the first iteration where the "load" >= "setpoint" here's a way to do it with a shift register.

0 Kudos
Message 2 of 6
(166 Views)

Can you explain the full functional requirements:

 

  • Since the "boolean" (I am sure there is a better name!) is a control, is the user supposed to interact with it or is it just a scaffold for value property nodes?
  • Where is "elsewhere?" Where does the next setpoint come from? Is it just a manual change in the setpoint control?
  • I only see one loop, so I am not sure what you mean by "first loop".

(There is no need for value properties anywhere)

 

It also helps to do a "save for previous" (2020 or below) before attaching so many more have a chance to look at your VI. I also recommend to place more reasonable default values into your controls.

0 Kudos
Message 3 of 6
(136 Views)

Sorry, I should have labeled that better. It’s basically a latching control used to set the timer’s reset to true or false, and it’s called from multiple parts of the program.

During operation, my only goal is for it to set the timer reset to false only when the load cell exceeds the setpoint for the first time. In the main program, there is an array of times and setpoints; it steps through these, applying a set load for a certain time and then moving on to the next one.

Sometimes I don’t want the timer to start until the load reaches that setpoint, so I just need something else to control whether the timer is enabled (true or false). The rest of the code works perfectly.

0 Kudos
Message 4 of 6
(85 Views)

it seems that when starting the program with the load setpoint higher that actual load the timer will start anyway 

0 Kudos
Message 5 of 6
(82 Views)

@amthonys777 wrote:

Sorry, I should have labeled that better. It’s basically a latching control used to set the timer’s reset to true or false, and it’s called from multiple parts of the program.

.


Careful there with terminology! A "latching" boolean control in LabVIEW refers to the mechanical action setting, making it true until it gets read once by the code. This will prevent its use with value properties or local variables.

 

So you want to measure the time it is at or above the setpoint. Since this is not a simulation and there is noise, the value could fluctuate slightly so I assume you want to start the timer the first time the setpoint is reached and continue counting seconds even if it drifts slightly below at times later. Correct?

 

Is the new setpoint always higher than the previous? What should happen to the time display once a new setpoint is set but before it is reached (stay at the current time? Show zero?)

 

As I said, once you do a "save for previous" and attach a 2020 version, I can give more specific help. A simple state machine is probably all you need.

0 Kudos
Message 6 of 6
(60 Views)