generate a train of pulses

THE BOOK of DT's INTERRUPTS is an organization of interrupt service routines and other works written by Darrel Taylor, RIP.

Interrupt routines are arranged per Darrel's original list. Darrel Taylor's Instant Interrupts are an extension of the work of Tim Box whom in October of 2002 wrote INT_CTRL.pbp

Many of the forum members felt this is a long overdue project.

will be a valuable resource and a tribute to Darrel Taylor the "Fanatical Contributor".

THE BOOK of DT's INTERRUPTS is located at

+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2010

    Default generate a train of pulses

    Hello friends!! I need to generate a train of 40 pulses of about 2us (2 micro seconds) each one.
    Does exist some type of instruction or procedure to obtain it?
    Thank you a lot

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

    Did you find this post helpful? Yes | No


    Try the PauseUs command ?

    From the manual
    Pause the program for Period microseconds. Period is 16-bits, so
    delays can be up to 65,535 microseconds. Unlike the other delay
    functions (NAP and SLEEP), PAUSEUS doesn't put the microcontroller into
    low power mode. Thus, PAUSEUS consumes more power but is also
    much more accurate.
    Because PAUSEUS takes a minimum number of cycles to operate,
    depending on the frequency of the oscillator, delays of less than a
    minimum number of microseconds are not possible using PAUSEUS. To
    obtain shorter delays, use an assembly language routine.
    OSC Minimum delay
    3 (3.58) 20us
    4 24us
    8 12us
    10 8us
    12 7us
    16 5us
    20,24 3us
    25-33* 2us
    40** 2us
    * PIC17Cxxx and PIC18Xxxx only.
    ** PIC18Xxxx only.
    PAUSEUS assumes an oscillator frequency of 4MHz. If an oscillator other
    that 4MHz is used, PBP must be told using a DEFINE OSC command.
    See the section on speed for more information.
    Last edited by malc-c; - 6th January 2011 at 19:22.

  3. #3
    Join Date
    Apr 2010

    Did you find this post helpful? Yes | No


    Thank you for your answer Malc-c
    I must use a 18Xxx family PIC

  4. #4
    Join Date
    May 2004
    NW France

    Did you find this post helpful? Yes | No


    Hi, Comte Vlad of the X (lol)

    this kind of work might be achieved through assembler including ... where a 4 Mhz Xtal will be more than enough.

    PBP ( and generally high level languages ) is ... ahum ... let's say not so good, for this kind of work !

    Now ... 40 pulses of 2s is rather fuzzy, as a signal shape description...

    ************************************************** ***********************
    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 " !!!

Posting Permissions

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