← All exercises

Min Max Tracker

medium

Tracks the minimum and maximum of an analog input and re-seeds both outputs while In_Reset is asserted.

What it teaches

Track the highest and lowest values the input has reached. Between resets, each output moves only when a new record is set — Max only rises, Min only falls, otherwise both hold. The trap is Reset: set both outputs to the current input value, not to zero. A Min reset to zero sticks at zero forever, reporting a low that never happened — the first value after a reset is the only honest starting point.

Inputs and outputs

TagTypeDefaultDescription
In_ValueREAL50Analog input value to track
In_ResetBOOLReset signal to re-seed minimum and maximum
Out_MinREALTracked minimum value
Out_MaxREALTracked maximum value

Required behavior