Okay I think I have made sense of this now- correct me if I'm wrong.
So if I wanted to set the comparator up with say an internal reference & output (cm<2:0> = 011), I would set the cmcon0 register as CMCON0 = %00000011 ?
Now to the VRR -
I think Im right in saying that the comparator uses the main VDD+ pin on the chip to compare the internal reference to? What I dont understand is this -
IF VRR=1 and VR3 ... VR0 = 1111 (15) with a VDD of 5V the Vref will be (15/24)*5 = 3,125V
^^ Where are they getting that 15 from? Also where do you get the 24 from?
IF VRR=0 and VR3 ... VR0 = 1111 (15) with a VDD of 5V the Vref will be 5/4+(15/32)*5 = 3,593V
^^ Also why has the 24 changed to a 32 just from vrr=1 changing to a 0?
One last question, Am I right in thinking that you have to use the CIN- pin on the chip to provide the voltage to check? Cant you use a comparator on any pin of the chip (apart from gp3, vdd & vss).
Thanks again,
Rob
Bookmarks