CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

need help setting up comparators in PIC18F87J10

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
zilog
Guest







need help setting up comparators in PIC18F87J10
PostPosted: Wed Jun 27, 2007 5:59 am     Reply with quote

I want Comparator 1 together with the internal voltage reference to input a signal on RF5, compare it with Vref ~0.5V, and output the result on pin RF2.

I have tried with the code below with no success - what am I doing wrong? The problem manifests itself that no matter what input level on RF5, I always get logic high on RF2.

Code:

#byte CVRCON = 0xFB5
#byte CMCON  = 0xFB4

set_tris_f(~0x04); //RF2 as output
CVRCON = 0xA5;
CMCON = 0x1E;
zilog
Guest







PostPosted: Wed Jun 27, 2007 6:00 am     Reply with quote

I forgot to mention that Vdd-Vss = 2.5V in my application.
Kenny



Joined: 07 Sep 2003
Posts: 173
Location: Australia

View user's profile Send private message

PostPosted: Wed Jun 27, 2007 6:11 pm     Reply with quote

The configuration that you have setup has no output to a port pin.
C1OUT is a bit in CMCON (see data sheet Fig. 21-1).

BTW the CCS constants defined in 18F87J10.h would make the code easier to read and see this kind of problem.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group