Hi Tabsoft,
Right I have changed the bits in the VRCON to the right stuff, so I think that is right now. I did change bits in the CMCON0 but none of it seemed to make a difference, so I have put it back to how it was. I'm thinking either I'm testing the wrong bit still or my actual hardware setup is wrong.
Maybe you can point something out?
BTW I am using the low range
Also this is correct - As I understand you want to check the input pin voltage against your "1.1" reference you are setting up internally and have the following outcomes: If the input is "Lower than 1.075 Vdc" you want the LED to be OFF and you want the LED to be "ON when the input is Higher than 1.075 Vdc".
Code -
Code:
'PIC 12F683
#CONFIG
__config _INTRC_OSC_NOCLKOUT & _WDT_OFF & _MCLRE_OFF & _CP_OFF
#ENDCONFIG
DEFINE OSC 4 '4mhz ocsillator
ANSEL = %00000010 'pin 6 analog
CMCON0 = %00000100 'comparator mode
VRCON = %10101000 'voltage reference
TRISIO = %00000010 'pin 6 input
POT1 VAR CMCON0.2 'pot pin 6
LED VAR GPIO.2 'led pin 5
PAUSE 20
main:
IF POT1 = 1 THEN
HIGH LED
ELSE
LOW LED
ENDIF
GOTO main
Thanks again,
Rob
Bookmarks