Quantcast
Channel: Microcontrollers
Viewing all articles
Browse latest Browse all 4928

Code of pic16f785 for PWM duty cycle control from a potentiometer

$
0
0
Hi I am trying to control a PWM duty cycle from a potentiometer but its not working as expected.

I have created a bit field for storing the upper 2 bits of the ADRESH register (i.e. left aligned adc) into the 2 bits of c which is put into bits 5:4 of the CCP1CONbits.DC1B. These bits form part of the 10 bit resolution of the CCP module. The other 8 bits come from ADRESL which is put directly into CCPR1L.

bits 7:6 is shifted right by 6 to bits1:0 and put into CCP1CONbits.DC1B.

On my...

Code of pic16f785 for PWM duty cycle control from a potentiometer

Viewing all articles
Browse latest Browse all 4928

Trending Articles