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 programming on MCU

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







event driven programming on MCU
PostPosted: Wed Feb 21, 2007 7:20 am     Reply with quote

Hello.
I was wondering if someone of you guys is using the event driven programming for mcu program design.

If so, please give me some links/advice.
KaraMuraT



Joined: 16 May 2006
Posts: 65
Location: Ankara/Turkey

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

PostPosted: Wed Feb 21, 2007 7:48 am     Reply with quote

Could you be more specific? For example what do you want to do?
_________________
/// KMT
/// www.muratursavas.com
grasspuddle



Joined: 15 Jun 2006
Posts: 66

View user's profile Send private message

PostPosted: Wed Feb 21, 2007 8:10 am     Reply with quote

The closest thing to event driven i write is an infinite loop that checks if a certain flag is set to true, and if it is it runs appropriate code.

Thats as complex as I want to go for PICs for event driven stuff.

i.e.

Code:


while(1)
{
     if (flag1)
          run_event_1();
     if (flag2)
          run_event_2();
}
davekelly



Joined: 04 Oct 2006
Posts: 53
Location: Berkshire, England

View user's profile Send private message

PostPosted: Wed Feb 21, 2007 8:19 am     Reply with quote

grasspuddle wrote:
The closest thing to event driven i write is an infinite loop that checks if a certain flag is set to true, and if it is it runs appropriate code.

Thats as complex as I want to go for PICs for event driven stuff.

i.e.

Code:


while(1)
{
     if (flag1)
          run_event_1();
     if (flag2)
          run_event_2();
}


This is pretty standard practice, so long as you have some interrupt driven way of setting the flag (timer, serial etc).

Depends on your specific application, you might act on flags set in timer interrupts, or use a switch statement for commands from the serial port, or read external ports to decide the action.
Mat.lk.
Guest







PostPosted: Wed Feb 21, 2007 9:31 am     Reply with quote

I have one project where i have to use the call handlers and gsm.
I have to make this thru event programming so i can use this logic on other hardware parts.

example:
detect incomming call
detect ring time in seconds

Code:
if (sec <10> 10){flag2;  sec=0;  } ??



Code:
#int_timerHandler
void timer0_isr()
{
   i++;
   if (i==100){
      sec++;
      i=0;
      // i dont know what is with this text formating but each time when i make preview i get wrong formating
// here are 3 if's .. =, <  ,  > then 10 sec.

   }
 }
void main()
{
enable_interrupts(int_timerHandler);
while(1)
{
     if (flag1)
          run_event_1();
     if (flag2)
          run_event_2();
}
}
Mat.lk.
Guest







PostPosted: Wed Feb 21, 2007 9:32 am     Reply with quote

Am asking this becuse i dont know how to start the second event and how to block the first ( by shutting down the whole timerHandler ? ) when the
call ringing time is longer then 10 seconds. In my case i need timer just to count the duration of the ringing so i guess i can make all this on the global (handler) part ?
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