Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

PIC16F628 Help needed, comparator wont compare

Status
Not open for further replies.

2camjohn

Member
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
 
The CMCON setting you currently use doesn't connect the reference output to a comparator input...

you might want to take a look at the comparator IO operating modes in the datasheet again
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top