Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] How to disable comparator using pic16f877 ?

Status
Not open for further replies.

Mzz Amin

Newbie level 5
Newbie level 5
Joined
Mar 18, 2014
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
86
i'm programming using mikroc c.
i'm still an amateur in the filed of c programming. I wanna copy that i found in mikro c library and i'm missing a trick whcich is how to disable the comparator because i'm working on pic16f877
 

According to the datasheet on page 136 the comparator register is CMCON, which works on 8 different ways.
Comparators Off (POR Default Value)
CM2: CM0 = 111
To disable the comparison, just put in your start routine code:
CMCON = 111;
For more information check the datasheet.
https://ww1.microchip.com/downloads/en/DeviceDoc/39582C.pdf
Hope this helps.
Regards, Tiago Ribeiro
 

Correction: those are the bit values, CM2 = 1, CM1 = 1, CM0 = 1. If you want to turn the comparators off write 0x07 to CMCON like this:
CMCON = 0x07;

or, if the other bits in CMCON are used elsewhere in the program and shouldn't be changed, use CMCON |= 0x07; instead.

Brian.
 

I would thank you, both of you, for your help but i'm working on pic16f877 and not pic 16f877A.
I've made more research and i found that there is nothing to be done to enable or disable comparater in pic16f877 because there is not such a thing, if i've understood really well what i've read and i've copied the code normally working on another pic and i've deleted the "disable comparator " instruction " and it worked well. thank you again

My best regards
Amin
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top