Multitasking using interrupt

Thread Starter

Dumken

Joined Oct 7, 2014
31
Hi Goodday everyone. Pls can someone help me with a code to multitask two events with Interrupt routine on mikroc. Thank you
 

Papabravo

Joined Feb 24, 2006
21,159
Would it kill you to provide some relevant details?
Which processor are we talking about?
What kind of interrupt are we talking about?
What are the two tasks?
 

Papabravo

Joined Feb 24, 2006
21,159
Like with all such requests, why doesn't the TS/OP tell us how he thinks it might be done and we can guide him in the right direction.

Here's a hint: In order to be useful for this purpose the interrupt should be periodic and occur on a fairly regular basis. This suggests a Timer interrupt or a periodic external interrupt.

Next question is: should the tasks run to "completion" or should they be preempted?
 

nsaspook

Joined Aug 27, 2009
13,085
The OP should first look at his problem and see if it can't get restated as a sequential task using a state machine. Most non-direct I/O tasks at the micro-controller level are easier and are more likely to be bug free this way.
 

Thread Starter

Dumken

Joined Oct 7, 2014
31
Sorry guys if i wasn't explicit in explaining my problem. Actually the code is for clock and a calendar using ds1307. Now i programmed the clock using seven segment display and did the calendar using dot matrix display. Each of them are running on different functions. When i try calling the functions into void main, it comes up after the each one has finished displaying. but i want the two events to be displaying at the same time. The only thing i could thing about was multitasking using interrupt but how to achieve that is wat i don,t know. Can someone help me now? Below is a picture of what i want to do.
 

Attachments

absf

Joined Dec 29, 2010
1,968
Can you tell us how long does it take to:

1. Read the time/date from 1307 and store them in the mcu ram?
2. Display the 4-digit time once?
3. Display the date in 8 characters 5x7 matrix once?
4. Is there any other job that has to be done routinely like detecting buttons?

Allen
 

sirch2

Joined Jan 21, 2013
1,037
I guess you only need to update the calendar once per day so it hardly needs multitasking, just read the calendar when the hour changes from 23 to 0.
 
Top