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.

CMCON register

Status
Not open for further replies.

ChArLyZzZ

New Member
Hi again guys,
I'm using PIC16F877 and i want to use the comparator module. I'm simply comparing the temperature sensor voltage to a predefined potentiometer value on PORTA0 and PORTA3
I disabled the Analog module, enabled the CMIE and assigned 0x02 to CMCON (my case). As the datasheet specifies, when the output of the comparator changes state, CMIF should be set which is not happening in my case!!
Do I miss something here??
Thanks guys really
 
Yeah everything is Enabled correctly.
I even tried to poll CMIF & it's giving me the same result, it's not setting!!
 
Wait a minute, by that "I disabled the Analog module" you ment that you disabled the ANALOG inputs ? Comparators need to have Analog inputs set up.
 
I set appropriately RA0 & RA3 to be analog by ADCON1 register. Is there anything more should i do? Is there any possibility that comparator module might be defected?
 
Theoretically it should work as you posted, but are you sure that you have 16F877(non-A version)? Because it doesn't have comparator module!!! 16F877A has it (so are you reading the A datasheet and using non-A part?)

And post your code, so we can find more bugs.
 
Is there a document available that details the differences between A and non-A versions of the same PIC? It doesn't appear to be part of the 16F87xA datasheet.

I thought both versions were basically identical feature-wise. Those differences are quite annoying. Makes you wish they used a new part number instead of appending an A...
 
Sure there is,

For example this was taken from 16F87xA datasheet, page 222:
 

Attachments

  • a_differences.gif
    a_differences.gif
    22.4 KB · Views: 753
Joel Rainville said:
I thought both versions were basically identical feature-wise. Those differences are quite annoying. Makes you wish they used a new part number instead of appending an A...

The new part is OK. The annoying thing is some "smart" engineers choose to enable the new features as default in the new "A" version so that most people who are unaware of the changes are being caught up.

Why can't they just make the new changes available via extra bits of the register settings so that on default, the part will work in the same way with previous codes?

Who can tell me why they do that?

edited: to change "brain dead" into "smart".
 
I know what you mean. I hate that too. Seems like the engineers didn't think about what it would cause to us. These extra features just brought us problems (aka unfamous Comparators On by default...)
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top