06-26-2023 05:16 PM
Dear Community members,
I am using this code to control a heater. The code works fine and serves my purpose. However, the problem is the stop button doesn't work. I want to use one stop button to stop the entire program, however, in my program it doesn't work. I feel I have not placed the stop button in right place but I can not figure out how to fix this. Any other suggestions regarding the code will also be appreciated.
I have further more questions about programming approaches. Any lead will be helpful.
a. I want to use Write to spreadsheet function to get data into excel files from the shift registers I used in the inner loop of the code. Is there a better way to do it? I plan to acquire data for 7 days at 2Hz sample rate.
b. Can I do active logging in labview? So that in case the pc crashes, I still have the data.
c. I have 6 more devices like the heater such as different kind of sensors and gas analyzer. I tested those on labview and those works fine separately. Now my plan is to integrate all of them to run simultaneously and acquire/log data for 7 days at 2Hz sample rate. Should I integrate everything into the loop with this one(heater) and run simultaneously? or there is a better way to do it?
d. If I want different sample rate for each of the devices, should I have separate while loop for each of the devices and run simultaneously?
I am not an expert in labview. However, I am willing to learn. Any help would be appreciated.
Thanks.
Solved! Go to Solution.
06-26-2023 09:16 PM
the inner loop does not stop when you press the button because it is not wired to the stop condition. Add another OR and wire it in.
(I have not studies the rest of the code, but it seems a bit convoluted. 😉 )
06-27-2023 09:42 AM
Stop trying to do everything in one big loop (OBL)
Before you try to band-aid in logging learn about simple state machine architecture.
Possible states are
Your program will probably spend most of its time in the measure, display, and control state. Then you can goto the log state what it's time to log.
The error state and be combined with the Exit sate to properly shut things down on error or user stop.
06-27-2023 06:45 PM
Do you think a producer consumer design pattern will be more appropriate for this case? I have no experience working with state machine. I tried to dig in and get some knowledge on this. But no luck so far.
06-28-2023 08:52 AM
@Jarir wrote:
Do you think a producer consumer design pattern will be more appropriate for this case? I have no experience working with state machine. I tried to dig in and get some knowledge on this. But no luck so far.
Sure but one if not both loops in a Producer/Consumer is usually contain State machines, at least mine always seem to...
06-28-2023 12:56 PM
I think there are tutorials to learn about state machine. A consumer and product er + state machine will give you a lot of confidence when it comes to programming with LabVIEW. So I will encourage to keep learning how to use state machine. Don’t give up. I will take a look at your code.