Sign in

username:

password:



Not a member?

Search msp430



Search tips

Subscribe to msp430



Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | MSP430 | Efficient way to generate pulse bursts


Advertise Here

The purpose of this group is to foster exchange of information on the Texas Instruments MSP430 family of microcontrollers and related tools. Everyone welcome, all levels of familiarity/expertise.

Efficient way to generate pulse bursts - Vishal Kema - Nov 15 22:59:53 2009

Friends,

A couple of days ago I was trying to generate pulse bursts from MSP430. Her=
e is what I had to generate.

Task: To generate 25.7KHz square wave signal for 200us (pulse bursts). Two =
pulse bursts are separated by 100ms.

My approach:

Make use of 16MHz clock, use timer A and set TACCR0 such that pin toggles a=
t 25.7Khz. Add a variable which would count 5 25.7KHz pulses and then sets =
the pin to 0 using loop.

You can see the code below:=20

main (){

WDTCTL =3D WDTPW + WDTHOLD;=20

BCSCTL1 =3D CALBC1_16MHZ;
DCOCTL1 =3D CALDCO_16MHZ;

P2OUT |=3D 0x08;
P2DIR |=3D 0x08;

TACCTL0 =3D CCIE+OUTMOD_4;=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=20
TACCR0 =3D 310;

TACTL =3D TASSEL_2 + MC_1;=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=20
=A0
=A0 __bis_SR_register(LPM0_bits + GIE);=A0=A0=A0=A0=20
}

#pragma vector=3DTIMERA0_VECTOR

__interrupt void Timer_A (void)
=A0 P2OUT ^=3D 0x08;=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=
=A0=A0=A0=A0=A0=A0=A0=A0=A0=20
=A0 i++;
=A0 if ( i =3D=3D 10){
=A0 =A0 =A0=A0 for (j=3D0;j<=3D80000;j++){
=A0 =A0 =A0 =A0 =A0 =A0 P2OUT &=3D ~0x08;
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 }
=A0 =A0 =A0 =A0=A0 j =3D 0;
=A0 =A0 =A0 =A0=A0 i =3D 0;
}=A0=A0=A0=A0=A0=A0=A0=A0=20
}
I was just trying to figure out a better way to implement this and hence th=
is e mail. I am typing this e mail so that I can get to hear suggestions fr=
om you ppl who has good experience with embedded programming.=20

I have attached two pictures of the output signal which is the result of my=
code. Same kind of signal has to be seen at the pin using a different and =
a better approach.

Thanks guys.

The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. =
http://in.yahoo.com/

[Non-text portions of this message have been removed]

------------------------------------



(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )


Re: Efficient way to generate pulse bursts - waldemar - Nov 16 4:42:41 2009


> Friends,
>
> A couple of days ago I was trying to generate pulse bursts from MSP430. Here is what I had to generate.
>
> Task: To generate 25.7KHz square wave signal for 200us (pulse bursts). Two pulse bursts are separated by 100ms.
>
>
Hi Vishal,

perhaps you can use timer_A to generate a PWM signal with 50% duty cycle
using capture register and generate timer_A interrupt to count pulses in
a burst and the pause time. Just an idea.

Waldemar
------------------------------------



(You need to be a member of msp430 -- send a blank email to msp430-subscribe@yahoogroups.com )