I feel really stupid not being able to make this work.
I am using XC8 compiler, inside MPLAB.
I am using the Microchip Code Configurator.
My problem is, that i can get the PWM to start, and i can change its initial value by modifying the registers in the initialization file pwm.c
But, when I put the following into my while loop for the main program, I cant seem to control the duty cycle. Clearly i'm doing something fundamentally wrong, but i'm too new to this to see it. This is towards the bottom of my main.c file. I didnt modify anything beyond adding the PWM1DCL = 1;
I expected this to turn on, and immediately adjust the pwm to a very low duty cycle. But it does not, it stays at 200.
I am using XC8 compiler, inside MPLAB.
I am using the Microchip Code Configurator.
My problem is, that i can get the PWM to start, and i can change its initial value by modifying the registers in the initialization file pwm.c
Code:
//PWM1DCH 0;
PWM1DCH = 0x00;
//PWM1DCL 200;
PWM1DCL = 200;
//PWM1PRH 0;
PWM1PRH = 0x00;
//PWM1PRL 255;
PWM1PRL = 0xFF;
Code:
while (1)
{
PWM1DCL = 1;
// Add your application code
}