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

What would be your solution to an event driven code?

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



Joined: 14 May 2004
Posts: 330

View user's profile Send private message

What would be your solution to an event driven code?
PostPosted: Thu Feb 17, 2005 11:24 pm     Reply with quote

Hi,

Talking about a program to watch 8 a/d inputs and 2 digital.

A good amount of math is involved, but they need to be evaluated only when one of the input changes.

I want to know how would you code it, no code needed just ideas.

Thank you.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Feb 17, 2005 11:49 pm     Reply with quote

If I had to do it, I would use multi-tasking method that I describe
in this thread, and poll the inputs in one or more tasks (routines).
If the input had changed to a specified state, then I would also
perform some appropriate action in the task routine.
http://www.ccsinfo.com/forum/viewtopic.php?t=17189
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Fri Feb 18, 2005 8:18 am     Reply with quote

My method would be very similar to PCM's. Recently, I have been taking a more modular approach. I have a timer set to go off at a certain interval. This is the "system tick". The main loop monitors the system tick and when it occurs calls a routine in each of my modules to handler their timers. In each of the module timer routines if anything needs to happen, a module level flag is set. The main loop also calls a task routine in each of the modules. This routine who check its flags and do the appropriate task. For my system tick, I actually increment a variable rather than just set a flag. The main "system tick" monitor gets called anytime the tick var is greater than zero. This keeps the whole system "in time" in case any task takes longer than a tick period.
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