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 support@ccsinfo.com

Question on the CCP Module

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



Joined: 21 Oct 2003
Posts: 58

View user's profile Send private message

Question on the CCP Module
PostPosted: Wed May 03, 2006 9:42 am     Reply with quote

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







PostPosted: Wed May 03, 2006 10:11 am     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Thu May 04, 2006 7:10 am     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Thu May 04, 2006 7:11 am     Reply with quote

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 ! Wink

Once you have a 0 you can in any cycle measure your current...
_________________
Fanie
FAZE
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