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 CCS Technical Support

16F616 comparator

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



Joined: 12 Nov 2007
Posts: 37

View user's profile Send private message

16F616 comparator
PostPosted: Mon Feb 01, 2010 6:29 am     Reply with quote

I need comparator about 1,8 internal Vref, RC3 is input and A2 is output.

Is this OK?
Code:

setup_vref(VREF_LOW|9);
setup_comparator(CP1_A1_VREF);
setup_comparator(CP1_OUT_ON_A2);
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Feb 01, 2010 2:29 pm     Reply with quote

Quote:
setup_vref(VREF_LOW|9);
setup_comparator(CP1_A1_VREF);
setup_comparator(CP1_OUT_ON_A2);

Setup statements are not cumulative.

Look in the Comparator section of the 16F616.h file. It says:
Quote:

// OR together one from the first group with one from the second
.
(List of #define statements in "first group")
.
.
.
// and any of the following
.
.
(List of #define statements in "second group")
.
.

Use only one setup_comparator() statement. Combine the constants
with the bitwise-OR operator: |
jjude



Joined: 12 Nov 2007
Posts: 37

View user's profile Send private message

PostPosted: Mon Feb 01, 2010 11:22 pm     Reply with quote

PCM programmer wrote:

Use only one setup_comparator() statement. Combine the constants
with the bitwise-OR operator: |

|-operator???
setup_comparator(CP1_A1_VREF | CP1_OUT_ON_A2);
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Feb 02, 2010 2:38 pm     Reply with quote

Yes, that's how you combine the constants.
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