|
|
View previous topic :: View next topic |
Author |
Message |
ahyow Guest
|
SLA Battery Charger |
Posted: Tue Nov 08, 2005 9:57 am |
|
|
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
|
|
Posted: Tue Nov 08, 2005 10:40 am |
|
|
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
|
|
Posted: Tue Nov 08, 2005 4:08 pm |
|
|
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. |
|
|
|
|
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
|