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

32bit non volatile counter

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



Joined: 13 Jun 2006
Posts: 164

View user's profile Send private message

32bit non volatile counter
PostPosted: Tue Sep 23, 2008 1:53 pm     Reply with quote

I know this a bit off the topic but thought this would prob be the best place to ask. I have a project coming up and i need to implement a 32bit counter (24bit if it really has to).

I was thinking of using the ext_int on a 24 series pic and incrementing a 32bit variable. the problem is that when the power fails or a reset occurs i might lose the count value, so preferably i would want some standalone chip with a count input and an i2c or spi bus for pic comms.

Does anyone know of such a chip?? the specs at this time is still not to clear but i suspect a few hundred pulses per second.

PS I know of some counters but they have BCD output and can't count to 32bit.

Thanks in advance
Ttelmah
Guest







PostPosted: Tue Sep 23, 2008 2:00 pm     Reply with quote

Add a power fail interrupt, and save the counter value, when the power drops.
Did this nearly twenty years ago, on systems that count 'copies' on high speed printers. Some are still running....
Or just maintain power to a CMOS counter. When not clocked, you can keep a CMOS chip operating, on pA in some cases.

Best Wishes
crystal_lattice



Joined: 13 Jun 2006
Posts: 164

View user's profile Send private message

PostPosted: Tue Sep 23, 2008 2:11 pm     Reply with quote

Thanks Ttelmah, was thinking of doing the power fail backup routine, but in the case of cpu malfunction... the cmos counter sounds more robust, do you have any you could suggest?

The problem I can foresee with the incrementing of a variable is the delay involved with incrementing a 32bit variable when the input frequency is high and then missing a pulse.

The cmos timers: what kind of interface do you have with the pic?

I am trying to keep track of a car's Km's using a inline pulse unit or picking up a signal from the cluster.
crystal_lattice



Joined: 13 Jun 2006
Posts: 164

View user's profile Send private message

PostPosted: Tue Sep 23, 2008 3:02 pm     Reply with quote

My background search in google did not really return any cmos counters but it did return a hit on a LSI quadrature encoder counter which has a counter mode which should work in my project. never used them before but think I have seen them mentioned on here, else any other encoder should also work. Just concerned about the price as I am trying to keep things as cheap as possible while getting what i want...

I should have mentioned that the counter needs to be presettable and and have a software programmable input divider... to cater for different car's pulses per km/mile or is this a standard number on all cars??
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