Hopefully this is just a matter of me being daft and can be easily cleared up.
I'm working on hardware PWM using a PIC16F627A. I intend to use a 10bit duty cycle, or at least develop a function for handling a 10bit cycle even if I later move to 8bit.
According to the datasheet, the 8 MSB should get written to CCPR1L while the 2 LSB should be written to bytes 5 and 4 of CCP1CON.
Ok, sounds a little awkward but understandable. Any pointers on efficient ways to do that in C would be appreciated.
What confuses me is that in the examples I've seen, people just write their duty cycle to CCPR1L. I've not come across an example where someone is splitting it. Are they simply discarding the LSBs and assuming everyone wants 8bit, or is there some magic happening in the background that I don't know about here that drop the LSB into the right place?
My suspicion is that the others are simply using 8bit...
I'm working on hardware PWM using a PIC16F627A. I intend to use a 10bit duty cycle, or at least develop a function for handling a 10bit cycle even if I later move to 8bit.
According to the datasheet, the 8 MSB should get written to CCPR1L while the 2 LSB should be written to bytes 5 and 4 of CCP1CON.
Ok, sounds a little awkward but understandable. Any pointers on efficient ways to do that in C would be appreciated.
What confuses me is that in the examples I've seen, people just write their duty cycle to CCPR1L. I've not come across an example where someone is splitting it. Are they simply discarding the LSBs and assuming everyone wants 8bit, or is there some magic happening in the background that I don't know about here that drop the LSB into the right place?
My suspicion is that the others are simply using 8bit...