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

Event driven datalogger

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







Event driven datalogger
PostPosted: Fri Jan 18, 2008 8:11 am     Reply with quote

Hi,

I'm in the process of designing an event driven datalogger that will have approximately 10 digital inputs. The interfaces to be used are LCD, EEPROM, RTCC, RS232, all of which i have tested and all work okay. The PIC i'm using is the 18F452.

I'm now starting to think about the software for the main program and this is where i'm weak (software!) but learning slowly. As the datalogger will be event driven, i was thinking of scanning each input in turn and if a state change occurs, then log the state, time and date to EEPROM. Sounds simple but i can't think of a way of only capturing the time on a state change (due to lack of programming experience).

Has anyone got some ideas that could point me in the right direction to get started?

Regards

mns
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jan 18, 2008 12:03 pm     Reply with quote

Add a Real Time Clock (RTC) chip such as the DS1307. Then read the
date and time from it whenever a trigger event occurs. Then write a
record to an external eeprom chip, such as 24LC256. Look in the CCS
code library for drivers for RTC chips, or look in the CCS drivers
directory on your hard disk.
mns
Guest







PostPosted: Sat Jan 19, 2008 2:38 pm     Reply with quote

Thanks for your reply.

I'm already using the rtc ds1302 and can display the time date etc but i'm having trouble trying to get my head around the fact that i only want to know the time on each state transition of each input.
I think i know how to just capture the time when say the input goes high but not sure how to just read that time and then return to polling the inputs.

Regards

mns
Neutone



Joined: 08 Sep 2003
Posts: 839
Location: Houston

View user's profile Send private message

PostPosted: Sat Jan 19, 2008 6:18 pm     Reply with quote

mns wrote:
Thanks for your reply.

I'm already using the rtc ds1302 and can display the time date etc but i'm having trouble trying to get my head around the fact that i only want to know the time on each state transition of each input.
I think i know how to just capture the time when say the input goes high but not sure how to just read that time and then return to polling the inputs.

Regards

mns


A simple method would be to poll to see if any inputs have changed since the last log entry. If a change has occurred make a log entry. Run this as a function called from your main loop. Run a function for each interface.
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