PDA

View Full Version : Comparator help (16F627A)



JohnnyV
- 21st May 2008, 02:24
Is it possible to use the 16F627A's on board comparator to call a subroutine?

I would like to compare a voltage (that ranges from 3 to 0 VDC relative to ground) to the internal voltage reference set to 0.5V. If the input voltage is greater than 0.5V, I want a subroutine to be called.

I read the datasheet, but that just made me more confused. Couldn't find any good examples on how to use the comparator with Pic Basic.

So, what I need help with is:
1. How do I set the internal voltage reference to 0.5V with PBP?
2. How do I setup the PIC to get the voltage in with PBP?
3. How do I use the VRCON register to call a subroutine with PBP?

The PIC doesn't need to do anything if the input voltage is below 0.5V.

Any help is appreciated!

paul borgmeier
- 21st May 2008, 07:03
This should get you started (an oldie but a goodie - not Melanie ... her post)

http://list.picbasic.com/forum/messages/3064/3607.html?

DanPBP
- 23rd May 2008, 09:20
That's why I couldn't find that post on the forum! I was looking for it the other day but I didn't remember where it was. It was on the picbasic list! Thanks for finding it!

JohnnyV
- 24th May 2008, 04:09
Yes, thanks for the link, it was exactly what I needed!