pwm set up

Hello, I am prototyping with the pwm channels on a RCM6700.

Currently, I am trying to set a duty cycle and output the pulses.

I follow these steps (from the support manual):

  1. Configure Timer A9 via TAT9R to provide the desired PWM clock frequency.
  2. Configure PWLxR to select whether to spread the PWM output throughout the cycle.
  3. Configure PWLxR to select whether to suppress the PWM output.
  4. Configure the duty cycle by writing to PWLxR and PWMxR. Note that any changes to these registers
    while the PWM is active will not take effect until the next counter rollover.

I have tried using the functions pwm_init() and pwm_set() and manually setting up the registers using “WrPortI(TAT9R, NULL, 0x1F);”, etc…I don’t see an output.

A couple of questions:

  1. is there some config that I’m missing?
  2. if I config a parallel port to I/O, will it overwrite the pins which are used for pwm, quad decoder, etc…? Which has priority?


Okay. I am now using the returned value of each function to indicate if things are going through (freq = pwm_init(…) and ret = pwm_set(…)) and apparently my pwm duty cycle is not correct. I’m issuing a value between 0 and 1024 (raw number, no variable) and it’s not working. I will mess around with it and see what’s holding it up.
Any ideas are appreciated also…

Apparently, I am getting a -3 as a return. This is not in the function support documentation but is in the function library (PWM.LIB) and indicates a “no port selected”. I now have port D selected and it’s working!