On an Arduino, I've implemented an s-function to receive variables from a 2nd microcontroller via Serial.
The model, which can be deployed on the Arduino or run in external mode, is simply processing a PID block. The PID block seems to be outputing the correct control signal.
I want to Limit Output (under the Output Saturation tab) and use External Reset (under the Initialization tab) functions built in to the Simulink PID block.
However, neither of these functions work. I have verified the that these functions do work in the standard Simulink environment, but when I run it on the hardware, the outputs are not limited and the PID is not being reset.
Picture of model. S-function is top-right, PID block is bottom-left. GREEN is the set reference level, RED is the feedback, BLUE is the control signal, and YELLOW is a switch to toggle on/off the controller. As you can see I enabled the reset to be on the rising edge (0 -> 1). But the output never goes to the intiial condition. Also, the limit is set to 20,000; as you can see the control signal contionues to grow past the limit.