PDA

View Full Version : Darrel's SPWM: Frequency, processor time..



dran11
- 27th March 2014, 02:53
Hi,

I am playing with SPWM and instant interupts. Great thing!! I am progressing slowly and have few questions. Is it possible to change SPWM frequency when code is running, like with SSPWM? Also, what is the best way to disable unused PWM channels to free some processing time? Is it enough to set duty cycle to 0?

Thanks,

Dan,

Experimenter
- 28th March 2014, 22:51
Hi Dan,

Just bumping your thread because I'm keen to know the answers to your questions myself.

Especially regarding any workaround the issue of how to change the frequency on the fly.

I have been wondering whether the 'define' can reference an EEPROM address to this end ... but I don't know whether this is foolish ignorance on my part.

Regards,

T o n y

Darrel Taylor
- 29th March 2014, 17:56
Is it possible to change SPWM frequency when code is running, like with SSPWM?
No, the frequency is calculated at Compile-Time by the assembler.
As is ... you cannot change the frequency at Run-Time, and all channels run at the same frequency.


Also, what is the best way to disable unused PWM channels to free some processing time? Is it enough to set duty cycle to 0?
The number of channels are also fixed at Compile-Time.
It takes the same amount of processing when the dutycycle is 0 as it does at any other value.