Multitasking using interrupt

Discussion in 'Embedded Systems and Microcontrollers' started by Dumken, Aug 22, 2015.

  1. Dumken

    Thread Starter New Member

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

    Expert

    Feb 24, 2006
    10,179
    1,799
    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?
     
    nsaspook likes this.
  3. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,398
    497
    I am not OP, but yes, it would kill 'em.
     
  4. Papabravo

    Expert

    Feb 24, 2006
    10,179
    1,799
    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?
     
  5. nsaspook

    AAC Fanatic!

    Aug 27, 2009
    2,913
    2,181
    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.
     
  6. joeyd999

    AAC Fanatic!

    Jun 6, 2011
    2,693
    2,762
    There are 267,000 members on this forum. Of them, many have vast experience wrt multitasking, interrupts and MicroC. I suspect the complete answer to the question is, "Yes."
     
    djsfantasi and absf like this.
  7. absf

    Senior Member

    Dec 29, 2010
    1,493
    373
    If you're too lazy to give more details for your task, I'd suggest you read this thread first. The OP of this thread seems to have the same problem that you have...

    http://www.edaboard.com/thread195266.html

    HTH

    Allen
     
  8. Dumken

    Thread Starter New Member

    Oct 7, 2014
    19
    0
    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.
     
  9. absf

    Senior Member

    Dec 29, 2010
    1,493
    373
    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
     
  10. sirch2

    Well-Known Member

    Jan 21, 2013
    1,008
    351
    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.
     
    absf likes this.
Loading...