07-11-2025
11:23 PM
- last edited on
07-12-2025
12:15 AM
by
altenbach
I have the table exported to Excel, but I've been encountering some difficulties.
01 - When I start a pump, the Excel recording starts, but if I stop and start the pump again in a few minutes, it ends up recording in the file itself, but it doesn't overwrite.
02. I need to start the pump OR press another button to start the report, and when I click stop recording, it doesn't turn off the pump, it just stops recording the report. I've been encountering these difficulties with my program; I need help.
No mundo perfeito eu queria partir a bomba OU BT_IniciarRelatorio e pararRelatorio.
E ao clicar em IniciarRelatorio OU PartirBomba, ele automaticamente criar um outro arquivo excel e alimentar com as variaveis.
Solved! Go to Solution.
07-12-2025 12:22 AM
@Felipe_Alves17 wrote:
.
It is impossible to debug code pictures full of express VIs and dynamic data, because we cannot see how they are configured.
There is no toplevel loop visible. How are you running this? (hopefully not using the "continuous run" mode!)
Please attach your VI, make sure all controls have typical default data, and tell us exactly how you expect it to work.
07-12-2025 06:59 AM
Thank you for your quick response. I apologize for not including the VI in the post. Here it is.
My goal is: BT_partirBomba OR BT_iniciarRelatorio (this condition will start generating the report).
BT_pararRelatorio (this will stop recording the report without turning off the pump).
07-12-2025 08:49 AM - edited 07-12-2025 08:50 AM
Your timeout case has an infinite timeout and will never execute. The only time the While loop goes to the next iteration is after you change one of the switches. Any other time, the event structure blocks execution. The value of the switch seems irrelevant. Shouldn't they be latch action?
Can you explain step-by-step how you are running it, how you interact with it, and what you expect to happen.
There is a lot of questionable code, for example your case structure just returns the input unchanged. You can delete it, leaving just the wire and nothing will change.
07-12-2025 11:02 AM
I just posted a six-month late (I missed the original Topic's post) reply to "CMH and Continuous Measurement" on this Forum. It discusses a Design Pattern called the Channel Message Handler to create something like a State Machine that lets you use Front Panel Controls like "Start" and "Stop" buttons, as well as Settings for DAQ devices, to set up data acquisition and simultaneous display of the data (using a Stream Channel). You should be able to find this earlier Post and my response -- feel free to download the attachment I posted which includes a nine-page PDF that walks you through this demo.
Note that this illustrates an important advantage of LabVIEW, concurrent programming. There are three loops running in parallel -- a "top" loop called the "Event Handler", a While Loop enclosing an Event Structure that waits for rectangular button pushes on the Front Panel (do you know why I underlined "rectangular"?), the main Loop which is the Channel Message Handler acting as a State Machine, doing sequential/repetetive sections on code going one "state" at a time, and finally a "Consumer" loop that gets "data to be displayed" (or saved to disk) when the State Machine reads a "chunk" of data.
Feel free to adapt it to your situation, but first, take the time to run it and learn how it works (the documentation should help).
Bob Schor
07-12-2025 11:28 AM
I removed the Case, which made no difference; it actually made sense.
So, I want pressing BT_ligarBomba (Bomb ON) to turn on the pump and start recording the field variables, but pressing BT_pararGravacao (Stop Recording) to stop recording without turning off the pump.
I'm relatively new to LabView, and I'm encountering these difficulties that a seal might solve in LADDER.
07-12-2025 11:30 AM
I'll take a look at your schedule, maybe I can adapt it to my activity and be able to complete it.
07-12-2025 01:11 PM
You still don't have a timeout wired for the timeout structure, and placing a wait inside it makes no difference.
Also, if your timeout would ever trigger (once correctly wired!), it would immediately reset both shift register values to false. I doubt that's what you want.
07-12-2025 01:23 PM - edited 07-12-2025 01:23 PM
@Felipe_Alves17 wrote:
I removed the Case, which made no difference; it actually made sense.
So, I want pressing BT_ligarBomba (Bomb ON) to turn on the pump and start recording the field variables, but pressing BT_pararGravacao (Stop Recording) to stop recording without turning off the pump.
I'm relatively new to LabView, and I'm encountering these difficulties that a seal might solve in LADDER.
So what are all possible states of the system?
And the following state transitions:
You are simulating 5 values. Is that independent of the pump and should always happen (what rate)
07-12-2025 01:38 PM