Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
d37071f35This file is pinned to the selected release. Download the original to open it in your design tool.
COMP(minmax);
HAL_PIN(in) = 0.0;
HAL_PIN(min) = 0.0;
HAL_PIN(max) = 0.0;
HAL_PIN(hist) = 100.0;
MEM(float history[100]);
MEM(int histpos = 0);
RT_FILTER(
float in_ = PIN(in);
float min_ = in_;
float max_ = in_;
int hist_ = (int)PIN(hist);
history[hist_-1] = in_;
for(int i = 0;i<hist_-2;i++){
history[i] = history[i+1];
if(history[i] < min_){
min_ = history[i];
}
if(history[i] > max_){
max_ = history[i];
}
}
PIN(max) = max_;
PIN(min) = min_;
);
ENDCOMP;