View previous topic :: View next topic |
Author |
Message |
jfk1965
Joined: 21 Oct 2003 Posts: 58
|
Question on the CCP Module |
Posted: Wed May 03, 2006 9:42 am |
|
|
I have an application that measures current flow via a Hall effect sensor, the output of this is fed into a V to F convertor.
My initial idea was to simply count the number of pulses to report the state of charge using the CCP module.
There is however a problem in that with zero current flow the output of the hall effect sensor is 2.5V, with increasing current the voltage rises by 15mV per amp. If current flows the opposite way the voltage output reduces from 2.5V down to 0V at the same rate.
Can the CCP module be used to count the number of pulses and the time between them at the same time? Or can anyone think of a better way of doing this?
I intend to use the PIC18F4580 as I need to transmit this and other data over a CANBUS.
TIA
JFK |
|
|
Ttelmah Guest
|
|
Posted: Wed May 03, 2006 10:11 am |
|
|
There are a number of examples (in the CCS stuff, and also in the Microchip application notes), for using the CCP, to measure frequency. Normally you use on of the timer modules, to establish a 'tick', and read the CTC counts between successive ticks.
I have to ask though, why you don't just read the voltage from the Hall sensor directly, with an ADC?. Though you can achieve apparently high 'resolutions' using the V-F approach, remember that your 'accuracy' is limited by all the components, include those in the V-F converter...
Best Wishes |
|
|
fanie
Joined: 04 May 2006 Posts: 2 Location: Centurion Sunny South Africa
|
|
Posted: Thu May 04, 2006 7:10 am |
|
|
Hi JFK,
If you're using the Allegro current sensors it's quite easy to read the current. You read the highest value and the lowest value in a cycle. Read the a/d's for more than 20ms. The difference between max & min is your P-P value, and /2 is your 0.... Easy eh !
Once you have a 0 you can in any cycle measure your current... _________________ Fanie
FAZE |
|
|
fanie
Joined: 04 May 2006 Posts: 2 Location: Centurion Sunny South Africa
|
|
Posted: Thu May 04, 2006 7:11 am |
|
|
Hi JFK,
If you're using the Allegro current sensors it's quite easy to read the current. You read the highest value and the lowest value in a cycle. Read the a/d's for more than 20ms. The difference between max & min is your P-P value, and /2 is your 0.... Easy eh !
Once you have a 0 you can in any cycle measure your current... _________________ Fanie
FAZE |
|
|
|