XYZ_ABC
Newbie level 3
Hello everyone,
I am using the Power Control PWM module (PCPWM) in PIC18F4431 to generate the 6 PWM signals (SPWM) required for my three phase inverter. Since this is a three phase
application, i need three PWM signals 120 degrees phase shifted from one another and the other three PWM signals complement of these. For this i have
created a sine look up table with the duty cycle equivalents and three indices to point to three locations on the sine table to get the 120 degree
equivalent phase shifts in the respective PWM signals. PWM frequency requirement is 20kHz and the sine wave inverter output frequency is 50Hz. The sine table thus has
400 values.
I am using the continuous up down count mode of PWM and for 20kHz PWM frequency, 20MHz oscillator frequency, PTMR pre scale value 1:1,
the PTPER value was found to be 0x7D (Calculated using the equation in the data sheet). so the range of values that can be loaded into the duty cycle registers is
0 to 249.
I want the duty cycle registers to be updated from the sine lookup table every 50us (for one PWM period) so that the 400 values are read in one full cycle of the
sine wave which is 20ms.
I thought of using the timer0 to generate an interrupt every 50us, and in the interrupt routine i will update the PDC (Duty cycle registers 0,1 and 2) by reading
a value from the sine lookup table.
I am able to watch the registers updated in the MPLAB SIM.. but when the hex file is loaded to PROTEUS circuit with the microcontroller chip , there is no PWM
output...
What could be the problem? Kindly guide me with this. Am i right with the concept of timer0 interrupt to access the values from the sine table? anything else i shd
be checking or initializing for this?
PS: I have initialized the PCPWM module, initialized the timer0, loaded the timer0 with a value to generate interrupt at every 50us in the C program.
Its really very urgent kindly help me out with this. Thank you.
Regards,
XYZ_ABC
I am using the Power Control PWM module (PCPWM) in PIC18F4431 to generate the 6 PWM signals (SPWM) required for my three phase inverter. Since this is a three phase
application, i need three PWM signals 120 degrees phase shifted from one another and the other three PWM signals complement of these. For this i have
created a sine look up table with the duty cycle equivalents and three indices to point to three locations on the sine table to get the 120 degree
equivalent phase shifts in the respective PWM signals. PWM frequency requirement is 20kHz and the sine wave inverter output frequency is 50Hz. The sine table thus has
400 values.
I am using the continuous up down count mode of PWM and for 20kHz PWM frequency, 20MHz oscillator frequency, PTMR pre scale value 1:1,
the PTPER value was found to be 0x7D (Calculated using the equation in the data sheet). so the range of values that can be loaded into the duty cycle registers is
0 to 249.
I want the duty cycle registers to be updated from the sine lookup table every 50us (for one PWM period) so that the 400 values are read in one full cycle of the
sine wave which is 20ms.
I thought of using the timer0 to generate an interrupt every 50us, and in the interrupt routine i will update the PDC (Duty cycle registers 0,1 and 2) by reading
a value from the sine lookup table.
I am able to watch the registers updated in the MPLAB SIM.. but when the hex file is loaded to PROTEUS circuit with the microcontroller chip , there is no PWM
output...
What could be the problem? Kindly guide me with this. Am i right with the concept of timer0 interrupt to access the values from the sine table? anything else i shd
be checking or initializing for this?
PS: I have initialized the PCPWM module, initialized the timer0, loaded the timer0 with a value to generate interrupt at every 50us in the C program.
Its really very urgent kindly help me out with this. Thank you.
Regards,
XYZ_ABC