Multi-tasking


Closed Thread
Results 1 to 10 of 10

Thread: Multi-tasking

  1. #1
    malc-c's Avatar
    malc-c Guest

    Default Multi-tasking

    Hi,

    Firstly, thanks to Alain and Steve for their help on the "Dr Who" pulse light.. the "client" is really happy !

    I was just out in the garden doing a spot of weeding, and watched a plane go over (we live on the flight path of Luton airport) and noticed (as it was an older type of plane) that it had a red beacon under its belly, mid way between the wings. This beacon pulsed in the same way...

    Now I have in the past managed to write some code that runs through a loop double flashing three ports on a 12F675 that gives a nice strobe effect for model aircraft when using ultra-bright LEDs.

    Now here is the question... how simple would it be to get a PIC like the 12F675 to multi-task and run both loops at the same time, without waiting for either to finish. I've not written any code yet, especially as the original double flash routine was my baptisum (sp) of assembly, and effectivley I ended up just typing what I was told to !!

    I don't want you guys to spend hours writing sample code, as Im still working on other projects so it may be a while before I'll get started on this project, but just wanted to understand the complexity, if any, of multi-tasking.

  2. #2
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    947


    Did you find this post helpful? Yes | No

    Default SHould be quite simple really

    If you consider co-operative multi-tasking. I have seen some projects where the main loop calls several functions repeatedly. Each function performs a certain function and returns. When many functions are put together, you will see a kind of multi-tasking, but mind you; the key word here is 'co-operation'. Any function hogging the CPU will kill all the others.

    Pre-emptive multi-tasking should be a nightmare, I guess, on the PIC with its limited stack levels.

    Jerson

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    if i understand correctly, you may want to run a timer in background, read the value of it and do action with x,y or z value... or use the Darrel Taylor Multi_SSPWM routine.
    http://www.pbpgroup.com/modules/wfse...p?articleid=12
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    and multi tasking is an kind of impossible task... it give the impression of but it's not a real multi tasking... worst on 12F series.

    Fluent on 18Fs with their tons of great gadget.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Talking Re-inventing the wheel ?????

    Hi, Malc

    First, you have a look to THIS :

    http://www.mes-avions-rc.net/2nd%20video%20samples.wmv

    The "lightshow" heart is a simple 16C84 !!! whithout any multitasking ...


    Second, let's have a closer look to what you want to do

    Alain
    Last edited by Acetronics2; - 12th July 2006 at 08:57.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  6. #6
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Hi,

    Yup seen that vid.. that's one nice model !

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Default

    " Yup seen that vid.. that's one nice model !"

    Hi,

    I Know it more than well ... ( Laughs )

    It took me a little more time to find this second link ...

    http://www.mes-avions-rc.net/light%20test%201.wmv

    Alain
    Last edited by Acetronics2; - 12th July 2006 at 09:38.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  8. #8
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Those landing lights are bright !!

  9. #9


    Did you find this post helpful? Yes | No

    Default multiple timing routines

    You could use an incrementing, looping counter/timer that counts up to a number that is evenly divisible by all "timing" constants. After each increment, divide the counter total by the number of counts desired for each independent light (i.e. - 10 for one, 11 for another, 6 for a third). Check the modulus, and if it's 0, then set the associated countdown byte to turn on an output for the proper number of count cycles. Check your next constant and do the same. When you've done all 3, then decrement the countdown bytes and go to a routine to turn each output on if its associated countdown byte is non-zero. Rinse and repeat.

    Picster

  10. #10
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Hi,

    See these links:

    AN585 - A Real-Time Operating System for PICmicro™ Microcontrollers
    http://ww1.microchip.com/downloads/e...tes/00585b.pdf

    AN585 Source Code
    http://ww1.microchip.com/downloads/e...otes/00585.zip

    Best regards,

    Luciano

Similar Threads

  1. Multi Slow speed PWM and Instant Interrupts
    By DaveC3 in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 2nd November 2010, 12:50
  2. multi functions button press
    By malwww in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 27th May 2009, 00:12
  3. 16-48 pin Multi slow PWM
    By krohtech in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 28th March 2009, 03:28
  4. Multi diomencinal array
    By morphyn in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th February 2009, 21:19
  5. parallel port multi pic programmer?
    By SuB-ZeRo in forum Schematics
    Replies: 8
    Last Post: - 25th June 2005, 10:20

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts