It means bits 2 , 1, 0 are set 011What does this mean from the data sheet CM<2:0> = 011?
very common nomenclature to use the colon to be inclusive of all the bits in between 2:0
It means bits 2 , 1, 0 are set 011What does this mean from the data sheet CM<2:0> = 011?
very common nomenclature to use the colon to be inclusive of all the bits in between 2:0
If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
.
Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
.
There simply is no "Happy Spam" If you do it you will disappear from this forum.
Rob,
Yes Comparators can be confusing the 1st time using them on the PIC MCU.
First, have a read through this link.
http://www.cuteminds.com/index.php/e...23-comparators
It explains simply how the comparator
on the PIC12F683 can be used. Ignore the C language stuff, but pay attention
to the setup of the Comparator, especially the Second Case.
This case describes what you will probably implement.
This will give you the info on how the Comparator will work by polling the
Comparator output, NOT USING INTERRUPTS.
Once you have this digested, then you can move on to the Interrupt portion.
Use the equation for VRR=1 (Low Range): (VR3:VR0/24) x Vdd to set the "Threshold Voltage"
E.g.
Vdd = +5Vdc
VR3:VR0 = 5 (%1001)
Putting this into the equation above gives this CVref "Threshold voltage"
(5/24) x 5 = 1.042 Vdc
This will be the reference voltage that will be used to compare the input voltage to.
General Rules when using the Comparator:
1. Set the appropriate pins to analog for the Comparator with ANSEL
2. Set the direction of the pins appropriately with TRISIO
3. Configure the Compare Module using CMCON0
4. Configure the reference voltage using VRCON
To use the comparator, poll the value of the status bit in CMCON0.
See if this gets you started.
Regards,
Last edited by Tabsoft; - 23rd January 2015 at 19:10. Reason: Forget a general rule
Regards,
TABSoft
Bookmarks