multi-tasking


Closed Thread
Results 1 to 11 of 11

Thread: multi-tasking

Hybrid View

  1. #1
    Join Date
    Apr 2007
    Location
    Pennsylvania, USA
    Posts
    158


    Did you find this post helpful? Yes | No

    Default

    Driving fuel injectors?

    Depending on what kind of time frame you are talking it could be done by running a timer.

    #1 on at x time
    #1 off at x time
    #2 on at x time
    #3 off at x time
    #4 on at x time
    #4 off at x time

    Each loop can adjust the values that the timer falls on for the on and off times to adjust your output periods. Interupts could be used depending on how time sensitive you need it.
    Shawn

  2. #2
    Join Date
    May 2007
    Posts
    604


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by spcw1234 View Post
    Driving fuel injectors?
    More likely simultaneous output of 4 R/C PWM pulses - 1-2mS width, 50Hz frequency.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by rmteo View Post
    More likely simultaneous output of 4 R/C PWM pulses - 1-2mS width, 50Hz frequency.
    LOL - on this occasion you're not even warm.....

  4. #4
    Join Date
    Jan 2005
    Posts
    15


    Did you find this post helpful? Yes | No

    Default

    multi tasking ??? one processor does always one thing.....

    quite easy problem:
    all depends on your timing - use high speed oscillator (20Mhz)
    create a timer under interupt ( interupt 1ms) relaod timer
    create counters as much as you need.
    increment the counters on interupt and compare with value
    if match - relaod counters with new value ...
    beware that interupttime is smaller than 1ms !

    all other calculations can be done out of interupt.

    rgds
    tb

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    The only way you can have a PIC do more than one thing at a time is to have part of it done with hardware and the other in code. Sounds like you are going to need to use a timer so it might be doable.

    Look at interrupts in general and DT's instant to be specific for ideas.

    But do not be embarrassed to tell us about your project, unless...
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Nov 2005
    Location
    Bombay, India
    Posts
    969


    Did you find this post helpful? Yes | No

    Default

    Malcolm

    Your idea seems to fit the "Soft PWM" concept very well. Search here to find how to do it.

    A little pseudo code might show you how

    Code:
    ' In a timer interrupt
    
         DutyCycle = DutyCycle+1
         if DutyCycle < Value1 then
               Port1 = On
         else
               Port1 = Off
         endif
         if DutyCycle < Value2 then
               Port2 = On
         else
               Port2 = Off
         endif
         if DutyCycle < Value3 then
               Port3 = On
         else
               Port3 = Off
         endif
         if DutyCycle < Value4 then
               Port4 = On
         else
               Port4 = Off
         endif

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


    Did you find this post helpful? Yes | No

    Wink

    Hi, Malc

    The trick is to fire all 4 pulses at the same time ... and use the COMPARE function of a CCP to turn pulses off ...

    of course, you must calculate at first which is turned off in 1st, 2nd ...etc.

    and load the COMPARE value according to that.

    http://mathieu.agopian.free.fr/prog_pic/servoter/

    Alain

    PS: another way is to use the CCS RTOS tool ... but ... not PbP anymore !

    re P.S. ... You have too much things running at the same time, these days ... LOL
    Last edited by Acetronics2; - 27th December 2009 at 11:36.
    ************************************************** ***********************
    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 " !!!
    *****************************************

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, 13:50
  2. multi functions button press
    By malwww in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 27th May 2009, 01:12
  3. 16-48 pin Multi slow PWM
    By krohtech in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 28th March 2009, 04:28
  4. Multi diomencinal array
    By morphyn in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th February 2009, 22:19
  5. parallel port multi pic programmer?
    By SuB-ZeRo in forum Schematics
    Replies: 8
    Last Post: - 25th June 2005, 11:20

Members who have read this thread : 0

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