To run the code, complete the following steps:
- Set the AC power source output to 0V, turn on the
AC power source, slowly increase the output voltage from 0V to 220-VAC.
- Run the project by clicking on the button, or click Run → Resume in the Debug tab. The motor fault flags motorVars_M1.faultMtrUse.all need to be equal to "0" , if not, the user must check the current and voltage sensing circuit as described in Section 3.3.4.1.
- To verify the current and voltage-sensing circuit of the inverter for the motor, set the variable motorVars_M1.flagEnableRunAndIdentify to "1" in the Expressions window as shown in Figure 3-30. The motor_1 needs to run with v/f open loop, tune the v/f profile parameters in user_mtr1.h as below according to the specification of the motor if the motor does not spin smoothly.
#define USER_MOTOR1_FREQ_LOW_Hz (10.0f) // Hz
#define USER_MOTOR1_FREQ_HIGH_Hz (275.0f) // Hz
#define USER_MOTOR1_VOLT_MIN_V (10.0f) // Volt
#define USER_MOTOR1_VOLT_MAX_V (200.0f) // Volt
- The motor now spins with a setting speed in the variable motorVars_M1.speedRef_Hz, check the value of motorVars_M1.speed_Hz in the Expressions window. The value needs to be very close, as shown in Figure 3-30.
- Connect the oscilloscope voltage and current probes to watch the motor phase voltage and current as shown in Figure 3-31.
- Verify the overcurrent fault protection by decreasing the value of the variable motorVars_M1.overCurrent_A, the overcurrent protection is implemented by the CMPSS modules. The overcurrent fault is triggered if the motorVars_M1.overCurrent_A is set to a value less than the actual current, the PWM output is disabled, the motorVars_M1.flagEnableRunAndIdentify is cleared to "0", and the motorVars_M1.faultMtrUse.all is set to "0x10".
- The controller can now be halted, and the debug connection terminated. Fully halting the controller by first clicking the Halt button on the toolbar or by clicking Target → Halt. Finally, reset the controller by clicking on or clicking Run → Reset.
- Close the CCS debug session by clicking on Terminate Debug Session or clicking Run → Terminate.