different software times, impossible?


Results 1 to 39 of 39

Threaded View

  1. #2
    Join Date
    Oct 2009
    Location
    Utah, USA
    Posts
    427


    Did you find this post helpful? Yes | No

    Default Re: different software times, impossible?

    lutherblisset,

    No not impossible at all, but it may depend on the clock speed that your micro is running at, AND your ability to dream up the code to make it happen

    A couple of possibilities (depending on whether the two pulse rates are symmetrical with regard to themselves)
    What I mean by that is... is the pulse rate for the first pin a fixed rate? can it be handled by a PWM peripheral within the PIC? (and the same question holds for the second port, is its rate also fixed and could it be handled by a second PWM peripheral?)

    You could also use a couple of timer peripherals within your micro along with timer interrupts. Letting one timer control one output and the other timer control the second output. If the pulse rate is not symmetrical you could pre load each timer as it expires (and interrupts your micro telling it to change the state of the given output) with a new and if necessary, different value, so that it will roll over and interrupt the micro at a different time to change the output state as necessary to meet your requirements.

    Can the PIC be running at a high enough clock rate such that it has time to set one port.pin high then go and set the second port.pin high then come back and set the first port.pin low then wait a given amount of time and then set the second port.pin low, etc. etc.

    All the while keeping what ever time base and pulse rate that your application demands??

    From my perspective (non professional programmer) Nothing ever happens "AT THE SAME TIME" within the PIC and the various port.pins. There will always be some delay or latency from one act (program directive) and the next, though this delay may be so short (a few microseconds) that it is as though it were "at the same time". The question for you to answer is, is the latency or delay (dependent on clock speed and program execution) "good enough"??

    Using assembly code (or "machine language" as I used to call it) as opposed to PICBASIC code at certain points in your program may also shorten the latency and make things happen closer to "the same time".

    Others may have better insight and you should try and provide more information as to time duration, pulse rate, pause duration, chosen microcontroller, etc. etc. so that we have enough information to better answer your specific question.

    Just a few things to consider...
    Last edited by Heckler; - 19th January 2016 at 17:25.
    Dwight
    These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.

Similar Threads

  1. WDT times not as expected 18f46k80
    By longpole001 in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 18th July 2015, 04:22
  2. MCSP, PBP260, Win7 - is it impossible?
    By HenrikOlsson in forum General
    Replies: 18
    Last Post: - 26th January 2010, 17:08
  3. Drive relay between two times
    By Pedro Pinto in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th December 2009, 09:19
  4. Instruction times
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th June 2009, 09:16
  5. Calling Subroutines Multiple Times
    By Forkosh in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 17th March 2008, 07:11

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