Min Max Tracker
medium
Track the minimum and maximum of an analog input until a Reset input is pulsed.
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
| Tag | Type | Default | Description |
|---|---|---|---|
| In_Value | REAL | 50 | Analog input value to track |
| In_Reset | BOOL | — | Reset signal to re-seed minimum and maximum |
| Out_Min | REAL | — | Tracked minimum value |
| Out_Max | REAL | — | Tracked maximum value |
Required behavior
- On the first scan, Out_Min and Out_Max initialize to the current In_Value to establish a valid baseline.
- Out_Max updates to match In_Value whenever In_Value is greater than Out_Max.
- Out_Min updates to match In_Value whenever In_Value is less than Out_Min.
- Out_Min and Out_Max hold their current values when In_Value is between them.
- When In_Reset is high, Out_Min and Out_Max are immediately set to the current In_Value.