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

how to configure the comparator 18f2550

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



Joined: 17 Jul 2010
Posts: 3

View user's profile Send private message

how to configure the comparator 18f2550
PostPosted: Sun Jul 18, 2010 10:40 am     Reply with quote

What is the difference between "interrupt and clear pin" and "interrupt and set pin"? I have to compare such a voltage of 3.13v with pin A3... What should I set in VREF? Because it is repeated 2 times the 3.13v? and then where take the pin C1OUT which is the result of the comparison?
Code:

void main()
{
   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_CLOCK_DIV_2);
   setup_spi(SPI_SS_DISABLED);
   setup_wdt(WDT_OFF);
   setup_timer_0(RTCC_INTERNAL);
   setup_timer_1(T1_INTERNAL|T1_DIV_BY_1);
   setup_timer_2(T2_DISABLED,0,1);
   setup_ccp1(CCP_COMPARE_SET_ON_MATCH);
   setup_comparator(A3_VR_A2_VR);
   setup_vref(VREF_LOW|12);

   //TODO: User Code

}
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sun Jul 18, 2010 2:40 pm     Reply with quote

Look at some of the comparator threads in the forum:
http://www.ccsinfo.com/forum/viewtopic.php?t=42946
http://www.ccsinfo.com/forum/viewtopic.php?t=26861
http://www.ccsinfo.com/forum/viewtopic.php?t=22955
http://www.ccsinfo.com/forum/viewtopic.php?t=27985
This should give you some ideas on how make a comparator program.
Also read the PIC data sheet in the comparator section.
If you still have problems, post your test program and your compiler
version, and explain how it doesn't work in detail. Explain your test
setup, including external circuits, the voltages involved, etc.
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