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

SLA Battery Charger

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







SLA Battery Charger
PostPosted: Tue Nov 08, 2005 9:57 am     Reply with quote

I'm a newbie in using PIC. I'm currently doing a project on a sealed lead-acid (SLA) battery charger using PIC16F876. My project closely resembles the one that is in Microchip website, "Lead-Acid Battery Charger Implementation Using PIC14C000" - AN626. The battery used is 1.2Ah 6V.

My question is that how can I configure my PIC so that it can function as a comparator (I only need to use one comparator) and at the same time using other PortA pins for ADC? It seems that both functions (comparator and ADC) use PortA.

Please help. Thanks
Ttelmah
Guest







PostPosted: Tue Nov 08, 2005 10:40 am     Reply with quote

You can't.
Hardware features can only be used on chips that actually 'have' the required feature. The 16F876, does not have comparator inputs. Switch to the 16F876A, which has both a comparator, and an ADC.
Now, once you have a chip that has the required hardware, what you have to do, is look at the possible configurations. If you select an ADC mode that allows the ADC to work on (say) AN0 to AN5 (ALL_ANALOGS), and then setup the comparator to use AN0 to AN3 (A0_A3_A1_A3), you can then use the comparator on these low pins, and the ADC, on the higher pins (AN4, or AN5), without problems. The setup in the ADC, only defines which pins are routed to the analog multiplexer, provided you don't actually 'use' a pin that is also in use for the comparator, there is no comflict.

Best Wishes
kender



Joined: 09 Aug 2004
Posts: 768
Location: Silicon Valley

View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger

PostPosted: Tue Nov 08, 2005 4:08 pm     Reply with quote

If you don't have to detect the overcurrent very quickly, yon could just sample your analog line with the A/D and compare digitally. This also gives you an advantage of a firmware-adjustable threshold.

Just my $0.02.
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