How generate short pulse in spin language ?
Francesco Santandrea
Posts: 16
Hello,
this simple spin program generate short pulse at pin 0
CON
_xinfreq = 5_000_000
_clkmode = xtal1 + pll16x
PUB Pulse
dira[noparse][[/noparse]0]:=1
!outa[noparse][[/noparse]0]
!outa[noparse][[/noparse]0]
Why the on time of pulse is so long ? about 20 microseconds (45kHz)
How can generate a short pulse in spin language ?
Thanks
Francesco Santandrea
this simple spin program generate short pulse at pin 0
CON
_xinfreq = 5_000_000
_clkmode = xtal1 + pll16x
PUB Pulse
dira[noparse][[/noparse]0]:=1
!outa[noparse][[/noparse]0]
!outa[noparse][[/noparse]0]
Why the on time of pulse is so long ? about 20 microseconds (45kHz)
How can generate a short pulse in spin language ?
Thanks
Francesco Santandrea

Comments
OPS
...
about 20 microseconds (45kHz) ...
is .... about 10 microseconds (100kHz if repeated)...
http://www.rayslogic.com/propeller/PulseGen.htm
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 outpin = 0 ctra0 = %00100 << 26 | outpin 'NCO with output on outpin. frqa0 = 1 'Increment by 1 on each clock. dira0 = 1 << outpin PUB Start | t dira := dira0 'Set pin as output. frqa := frqa0 'Initialize frqa. repeat repeat t from 1 to 100 'Pulse widths from 12.5ns to 1.25uS. repeat 10000 Pulse(t) PUB Pulse(t) phsa := -t 'Set phsa for pulse width. ctra := ctra0 'Start the counter. repeat while phsa < 0 'Wait for MSB to go low. ctra~ 'Stop the counter.-Phil
and if I should be reduced the time between pulses?
Is possible with stop of Cogs ? or otherwise ?
Francesco Santandrea
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
for continuos output
example for
PWM high resolution (10-12 bit and more)
100 - 200 kHz and more
To output a 10-bit PWM at 100KHz would require a pulse width resolution of less than 10ns. You won't get PWM output like that with the Propeller. If you don't need true PWM, though, but can settle for the Propeller counter's DUTY mode output, you will come close to your objective.
-Phil