PI controllers must be added to close speed loop. The PI controller here is implemented similar to C28 program for TIDM-02009. As the motor used in this work is an induction motor, there is another part, slip compensation, to close speed loop. It should be removed or replaced according to the actual motor in end equipment. The intend here is to show how to use the framework. The following line 1 and 2 shows the PI controller function calls, and line 3 to 6 shows the slip compensation. As there is division in line 6, line 4 and 5 are added to avoid zero in divisor.