Look at the MAX function - it is in the manual.
Vmax = Vmax MAX ADCvalue
As the ADC value rises the value of VMAX rises. When the ADC value falls, the value
of Vmax stays the same. If you sample for more than a full cycle VMax has the peak value of the sine wave.
If you are looking at the sine wave cycle-by-cycle, you will have to clear Vmax at zero crossing.
Bookmarks