Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
LinkBack Thread Tools Display Modes
Old 7th August 2004, 06:17 PM   (permalink)
Default PIC16F628 Help needed, comparator wont compare

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 first rule of mstechca club is do not talk about mstechca club.
http://www.electro-tech-online.com/s...induser&u=1245
2camjohn is offline  
Old 7th August 2004, 08:09 PM   (permalink)
Default

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
Exo is offline  
Old 10th August 2004, 05:05 PM   (permalink)
Default

Yeah cheers Im an idiot and I know it ops: ops: ops:
__________________
The first rule of mstechca club is do not talk about mstechca club.
http://www.electro-tech-online.com/s...induser&u=1245
2camjohn is offline  
Reply

Bookmarks

Thread Tools
Display Modes





All times are GMT. The time now is 04:31 PM.


Electronic Circuits  |  Learning Electronics
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.

eXTReMe Tracker