PDA

View Full Version : generate a train of pulses



xvladx
- 6th January 2011, 18:08
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

malc-c
- 6th January 2011, 19:20
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.

xvladx
- 7th January 2011, 22:37
Thank you for your answer Malc-c
I must use a 18Xxx family PIC

Acetronics2
- 8th January 2011, 10:02
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. :rolleyes:

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

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

Alain