Hi, I am trying to get a dsPIC33FJ256MC710 to produce a 50Hz Sine wave o/p from a LUT. I now have some basic working code but I need to clarifty a few things regarding the PWM registers as there is no sine wave o/p as yet!
PTPER reg is the PWM period reg and is pre-set with a value for this period.
PTMR is the timer that is used to count up to this value.
and PDC1 is the scaled PWM on-time value that is loaded from the sine LUT for that PWM period.
Once the timer is started eventually PTMR = PTPER and I presume a flag is set so the PTMR reg can be reset, a new value is reloaded into PDC1 from the LUT and the process repeats...
Can anyone tell me which flag I can use to tell me when PTMR = PTPER, is this just an interrupt flag or do you need to use O/P Compare registers?
Also how do I use the the LUT values to give the "ON" time for that period?
Any help would be most appreciated..
Thanks
PTPER reg is the PWM period reg and is pre-set with a value for this period.
PTMR is the timer that is used to count up to this value.
and PDC1 is the scaled PWM on-time value that is loaded from the sine LUT for that PWM period.
Once the timer is started eventually PTMR = PTPER and I presume a flag is set so the PTMR reg can be reset, a new value is reloaded into PDC1 from the LUT and the process repeats...
Can anyone tell me which flag I can use to tell me when PTMR = PTPER, is this just an interrupt flag or do you need to use O/P Compare registers?
Also how do I use the the LUT values to give the "ON" time for that period?
Any help would be most appreciated..
Thanks