Reply by old_cow_yellow March 30, 20082008-03-30
The example code you used generates a continuous train of pulses. Correct?

As written, the pulse width is always half of a period and is
determined by SMCLK and the constant +50,000. You cannot reduce the
constant much below +100 because it takes a lot of MCLK periods to
execute the ISR. Thus with MCLK=SMCLK=1MHz, your pulse width is about
100usec. If you increase MCLK=SMCLK to 16MHz, the pulse width will be
1/16 of what you get at 1MHz. Thus 10usec is possible.

You can also change the code and make TimerA generate a continuous
train of pulses without ISR or further involvement of the CPU. In that
case, you can have pulse width down to 1usec with 1MHz SMCLK. (And
down to 62.5nsec with 16MHz SMCLK.)

--- In m..., "dplescia" wrote:
>
> I am trying to use the 430F2013 (USB stick) for a quick and dirty 10uS
> pulse generator. I found an example in the slac080b
> (msp430x20x3_ta_01.c) folder that uses
> timer A in continuous mode to toggle P1.0 at about 20Hz. It sets CCR0
> to 50,000 and uses the timer A interrupt (adding 50,000 back to CCR0).
> I am able to decrease CCR0 to about 100 (giving me 100uS pulses), but
> any time I go lower, the pulses go back up to about 50mS.
>
> Am I exceeding the limits of the 2013 with respect to timer A? Is
> there another way that I can do pulse generation? Any help would be
> greatly appreciated.
>

Beginning Microcontrollers with the MSP430