Quote : So I'm using the Mitsubishi Q series, with gx works 2 and ladder logic. I'm using Arduino to gain hands-on experience with how the PLC interacts with the Arduino. For the HMI interface, the project will be simulated on the PLC using GT designer. The set point will be provided by the HMI between 0 and 144, and the PLC will convert the feedback and compare it to the setpoint. If the feedback is within +/-5 percent of the setpoint tolerance, the motor remains in the same position; otherwise, the PLC resends the setpoint to the Arduino to adjust the motor as needed.
Quote: I'm not sure I understand what you mean @parky, but the setpoint is given through the HMI, to the PLC and then to the Arduino. The Arduino does the output calculation (CV) to adjust the motor as needed, then the feedback is given to both the Arduino and the PLC.
Your descriptions do not make sense
On one hand you are saying if it is out of spec by 5% the PLC re-sends the setpoint surely The Arduino already has it, unless you are changing the set point ?
Again the above statement is that it already has sent the SP & the Arduino adjusts the CV to control the motor, why would you re-send the set point unless you change the set point for example set point is 130 this is sent to the Arduino, set point is changed by operator say 140 but the PLC only sends this set-point if it is outside of the original SP by 5%.
If this is what you mean then I get what you mean but what is the point of not changing if within 5 % of the last set point ? perhaps to stop the operator tweaking the set point for some reason.
So if this is what you want you need to do an on change bit of logic
so assume you start from scratch then you compare two registers with the current set point with the last set point if greater or less than the last set point + or - 5% then send it, if not do not send, the problems are:
At first go assume that the PLC has the set point and the last stored was zero then it sends the set point and then copies the set point into the last, fine however, then the HMI will display the updated set point but this is not what it is running at and will only change if a new set point is input that is greater or less than the original plus or minus 5%.
You could update the HMI back to the original, here it gets messy.
Perhaps if my assumption is right then you explain it a lot beter exactly what you are trying to acheive.