Oh I see, yes it sounds like the comparator will be the best then. Anyway thanks for your help guys, I have learned a lot.
I will be back lol
Rob
Oh I see, yes it sounds like the comparator will be the best then. Anyway thanks for your help guys, I have learned a lot.
I will be back lol
Rob
Back again already, Comparators are mind boggling !!
Firstly I have no idea how to even set the mode of the comparator, let alone working out & setting the VRC. I have been researching all day, the only info that looks helpful is in C so it is all gobbledygook to me as I have only just started learning basic.
I am not looking for someone to spoon feed me a code, I just want to be able to understand it for myself. What does this mean from the data sheet CM<2:0> = 011? How do you get CMCON0 = 2 from that? If I could understand the data sheet enough to put it into basic then it would help me a lot.
Just being able to turn on an LED when the voltage goes under 1.00v using a pot would be a massive accomplishment for me at the moment, as I could understand how it all works.
Any help on this would be great.
Thanks,
Rob
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
Thanks Tabsoft for that info & trying to help. I will go over all that until it becomes clear, I refuse to give up!
Thanks again,
Rob
Bookmarks