by Lost Tourist » Sat Oct 23, 2010 8:57 am
by Lost Tourist
Sat Oct 23, 2010 8:57 am
Thanks for the quick replies.
Roboard I’m not sure what your instructions are, I have removed pwm_EnableINT() (as I’m not trying to do anything fancy) with no success.
Are you saying that I have locked the pwm channel first or that I should lock the channel first, regardless of which why is there only an unlocking function in pwm_initialize if locking is required here?
As for the sync register are you saying it is used to start all pwm channels at once if required?
As all I am trying to do it write a new pwm_initialize that sets the counting mode as continuous can you correct the following steps and set the correct order to setup the PWM for continuous operation. (These steps being the steps and sequence used in pwm_initialize)
1 - Set base address to 0xffff
2 - Set the base clock using pwm_SetBaseClock(PWMCLOCK_50MHZ)
3 - Set interrupt mode with pwm_SetIRQ(PWMIRQ_DISABLE)
4 - Disable the pwm mode using pwm_DisablePin(channel)
5 - Disable the pwm interrupts using pwm_DisableINT(channel)
6 - Clear all PWM flags using pwm_ClearMultiFLAG(0xffffffffL)
7 - Set the counting mode using pwm_SetCountingMode(channel, PWM_CONTINUE_MODE)
8 - Set the waveform using pwm_SetWaveform (channel, PWM_WAVEFORM_NORMAL)
9 - Set the PWM pulse using pwm_SetPulse(channel, period, duty)
10 - Unlock the channel using pwm_Unlock(channel)
11 - Call pwm_EnablePWM(channel) to start the waveform
Because this does not seem to work.
Andrewmerrill thanks for your code as it works fine, although I don’t like double setting things so I wouldn’t normally use pwm_initialize to set the counting mode, waveform and pulse and then set them again separately unless there was a clear reason but I can’t argue with your results
Thanks
Thanks for the quick replies.
Roboard I’m not sure what your instructions are, I have removed pwm_EnableINT() (as I’m not trying to do anything fancy) with no success.
Are you saying that I have locked the pwm channel first or that I should lock the channel first, regardless of which why is there only an unlocking function in pwm_initialize if locking is required here?
As for the sync register are you saying it is used to start all pwm channels at once if required?
As all I am trying to do it write a new pwm_initialize that sets the counting mode as continuous can you correct the following steps and set the correct order to setup the PWM for continuous operation. (These steps being the steps and sequence used in pwm_initialize)
1 - Set base address to 0xffff
2 - Set the base clock using pwm_SetBaseClock(PWMCLOCK_50MHZ)
3 - Set interrupt mode with pwm_SetIRQ(PWMIRQ_DISABLE)
4 - Disable the pwm mode using pwm_DisablePin(channel)
5 - Disable the pwm interrupts using pwm_DisableINT(channel)
6 - Clear all PWM flags using pwm_ClearMultiFLAG(0xffffffffL)
7 - Set the counting mode using pwm_SetCountingMode(channel, PWM_CONTINUE_MODE)
8 - Set the waveform using pwm_SetWaveform (channel, PWM_WAVEFORM_NORMAL)
9 - Set the PWM pulse using pwm_SetPulse(channel, period, duty)
10 - Unlock the channel using pwm_Unlock(channel)
11 - Call pwm_EnablePWM(channel) to start the waveform
Because this does not seem to work.
Andrewmerrill thanks for your code as it works fine, although I don’t like double setting things so I wouldn’t normally use pwm_initialize to set the counting mode, waveform and pulse and then set them again separately unless there was a clear reason but I can’t argue with your results
Thanks