Sign in

username:

password:



Not a member?

Search msp430



Search tips

Subscribe to msp430



Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | MSP430 | Timer in capture mode error...


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.

Timer in capture mode error... - GustavoLima - Aug 6 0:35:11 2009


Hi,

I'm using the ez430RF2500 (MSP430 2274 + ZigBee module) and I need to
measure the time interval between input pulse signals (0V to 3.6V) . I
tried to implement a timer interrupt in capture mode but it don't
works. Someone can help-me? (my code with comments of the
configurations used is following)

Thanks
Gustavo
#include "msp430x22x4.h"
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer

//LED CONFIGURATION
P1DIR |= BIT0+BIT1; // Set P1.0 & P1.1 to
output direction
P1OUT = BIT0+BIT1; // Led on

//SIGNAL PORT
P2DIR = 0xF7; //P2.3 -> input
P2SEL = 0x08; //Select TA1

/*
5 pin - P2.2 / TA0 / Timer_A, capture: CCI0B input
6 pin - P2.3 / TA1 / Timer_A, capture: CCI1B input
8 pin - P4.3 / TB0 / Timer_B, capture: CCI0B input
9 pin - P4.4 / TB1 / Timer_B, capture: CCI1B input
*/

TACCTL1 = CM_3 + SCS + CCIS_1 + CAP + CCIE;

/*
CMx Bit - Capture mode
00 No capture
01 Capture on rising edge
10 Capture on falling edge
11 Capture on both rising and falling edges

SCS Bit 11 Synchronize capture source.
0 Asynchronous capture
1 Synchronous capture

CCISx Bit - Capture/compare input select.
00 CCIxA
01 CCIxB
10 GND
11 Vcc

CAP Bit - Capture mode
0 Compare mode
1 Capture mode

CCIE - Capture/compare interrupt enable.
0 Interrupt disabled
1 Interrupt enabled
*/

TACTL = TASSEL_2 + MC_1;

/*
TASSELx Bits - Timer_A clock source select
00 TACLK
01 ACLK
10 SMCLK
11 INCLK

MCx Bits - Mode control.
00 Stop mode: the timer is halted.
01 Up mode: the timer counts up to TACCR0.
10 Continuous mode: the timer counts up to 0FFFFh.
11 Up/down mode: the timer counts up to TACCR0 then down to 0000h.
*/

__bis_SR_register(GIE); // Wait interrupt
}
// Timer A0 interrupt service routine
#pragma vector=TIMERA1_VECTOR
__interrupt void Timer_A (void)
{
P1OUT ^= BIT0; //Toggle LED
}
--
View this message in context: http://www.nabble.com/Timer-in-capture-mode-error...-tp24839247p24839247.html
Sent from the MSP430 - Discuss mailing list archive at Nabble.com.

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



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