Hello,
I am working on a very basic program to map a potentiometer to a PWM output. I am designing this in stages so right now I am just trying to make sure the PWM output works but I am running into a weird problem. I use the MCC to generate the basic code for the PWM3 pin. I have the micro and the MCLR pull up populated and I am powering the circuit with a PICKIT 3. My while loop is literally on doing this
pwmDuty is a unit16_t and this code works fine as long as pwmDuty is <= 0x000F but once I go over that number the signal is always high and there is no PWM. I am watching it with my scope at home and its the weirdest thing. I am guessing its just a basic setting but I can't seem to put my finger on what one. Here are some other settings:
Thoughts?
I am working on a very basic program to map a potentiometer to a PWM output. I am designing this in stages so right now I am just trying to make sure the PWM output works but I am running into a weird problem. I use the MCC to generate the basic code for the PWM3 pin. I have the micro and the MCLR pull up populated and I am powering the circuit with a PICKIT 3. My while loop is literally on doing this
Code:
PWM3_DutyCycleSet(pwmDuty);
PWM3_LoadBufferSet();
pwmDuty is a unit16_t and this code works fine as long as pwmDuty is <= 0x000F but once I go over that number the signal is always high and there is no PWM. I am watching it with my scope at home and its the weirdest thing. I am guessing its just a basic setting but I can't seem to put my finger on what one. Here are some other settings:
- INTOSC
- WDT - OFF, PWRTE - OFF, BOREN - ON,
- PWM3
- Enabled, enable output pin
- Active hi, standard pwm
- CLK - INTOSC, Prescalar - 16
- Independent run mode
- No load buffer on trigger
- Period - 250us, Phase - 0, offset - 250uS
- No interrupts enabled
Thoughts?