I am writing a program to control our tempering oven. Currently, the program is working great. I am able to run profiles and update setpoints, read process values, update deadbands, update heating and cooling modes, etc. I am now finalizing the program but have run into an issue. Currently the program is taking a datapoint of the process value every second. Going forward, we only will need a data point every minute. I changed my timing to accommodate this and noticed that it caused my message handler loop to respond slowly as it has to wait 1 minute before the default case executes. Is there a simple way to get data points each minute without heavy modification of this program and without slowing down the message handler loop? Also, any other feedback on this program would be greatly appreciated. Thank you in advance.
Solved! Go to Solution.
If your loop runs once per second (good for getting data that you'll use to keep the loop fairly "current"), there's nothing that says you have to save all of that data. Count the points, and save every 60th (or once/minute).
Yes, that was my initial thought. I just wasn't sure how to implement that with my current setup.
I think @Bob_Schor described how to implement it.
Count the points, and save every 60th (or once/minute).
Something like this:
Notes on the case structures.
(I took the liberty of only using a 10 ms wait to make this example easier to see when running.)
Does this make sense?
That makes perfect sense. Thank you so much for your help and the great solution.
I just looked at what I posted...If you only need to use it in the "Update UI" case, you can replace the shift register with one of these:
Either one would simplify the diagram by pulling the Shift Register out so that the other cases didn't need it.
A better solution might be to use Time to track how often you need to save off data - it would be less dependent on magic numbers (like 60 and a Wait (ms) of 1000) and could save off the data every minute, independent of any loop timing changes.
That is a much cleaner way to do that. Thank you for the insight. I ran a temperature profile with it last night and it worked great. Appreciate the help.