I have recently switched my comparator on my PIC16f628 over from using an external reference voltage to the internal one.
THe problem is the state of the comparator doesnt change anymore.
Here is some pseudocode of a test program:
CMCON = %00000100 'set up internal comparator
VRCON = %10100010 'set up voltage reference module
TRISA = %11111100 'set all porta as input
TRISB = %11110000 'set portb
start:
High PORTA.6
While CMCON.0 = 1
Low PORTA.6
Wend
Goto start
I have checked the value of my reference voltage and it falls between the high and low values.
Its just meant to switch the light on and off as the comparator changes, but the light remains on.
Can someone help.
Thanks