If the current sampled value is less than the stored minimum value, copy the current sampled value to the stored minimum value.les prev min move min
If the current sampled value is less than the stored minimum value, copy the current sampled value to the stored minimum value.
For averaging, each sample period, add the current sampled value to a running total. At the same time increment a counter of the number of sampled values represented by the running total. The average value is the running total divided by the number of samples.
You will also probably need to provide a means to reset the maximum, minimum, running total, and number of samples.
It gets a little more complicated if you are trying to calculate a moving average and minimum and maximum values over a specific period of time.
Hi I think you would definitely gain something from a bit of classroom training, can I suggest you look into that?How do I "add the current sampled value to a running total"? I can create a counter to act as the dividend for the average calculation but not sure how to code the divisor
It's been at least 20 years since I last programmed a Modicon. So I can't remember the instructions.I am definitely looking into that, the more practice and training the better. I am using Schneider electric TM221CE24R
Got it thanks!