Other Parts Discussed in Thread: MSP-EXP430F5529LP,
Tool/software: Code Composer Studio
I am programming MSP-EXP430F5529LP (LaunchPad) with 2 timers (Timer_A0 and Timer_A1) with the following condition:
Timer_A0: Internal clock (ACLK), Up mode, Capture/Compare interrupt enabled, Timer Interrupt disabled
Timer_A1: External clock (P1.6), interrupt disable, Continuous mode
Timer_A0 is working properly (generating interrupt accordingly).
Timer_A1: I have a problem. I connect P1.6 floating, ground and VCC, and counter still running under those 3 condition(float, GND, VCC), which mean when I read TA1R (Timer counter register), I get different value. It should be counting only when I place P1.6 to a signal, the reading should return zero if P1.6 is grounded.
Is there is misunderstanding from me in the way those timers should work ? Below is a summary of the code been used to initialize the device. Any help is welcome.
GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P1, GPIO_PIN6); // TA1CLK
Timer_A_initUpModeParam gTimerA0params = {0};
Timer_A_initContinuousModeParam gTimerA1params = {0};
// Timer_A0
gTimerA0params.clockSource = TIMER_A_CLOCKSOURCE_ACLK; // Use ACLK as timer internal clock
gTimerA0params.clockSourceDivider = TIMER_A_CLOCKSOURCE_DIVIDER_1; // Divide clock frequency by 1
gTimerA0params.timerInterruptEnable_TAIE = TIMER_A_TAIE_INTERRUPT_DISABLE; // Timer interrupt disabled in TAxCTL Reg
gTimerA0params.captureCompareInterruptEnable_CCR0_CCIE = TIMER_A_CAPTURECOMPARE_INTERRUPT_ENABLE; // Capture-Compare interrupt enabled in TAxCCTL0 Reg
gTimerA0params.timerClear = TIMER_A_DO_CLEAR; // Clear time counter TAxR Reg
gTimerA0params.startTimer = false; // Do not start timer yet.
gTimerA0params.timerPeriod = 500; // Set timer period
Timer_A_clearTimerInterrupt(TIMER_A0_BASE);
Timer_A_initUpMode(TIMER_A0_BASE, &gTimerA0params);
gTimerA1params.clockSource = TIMER_A_CLOCKSOURCE_EXTERNAL_TXCLK; // Use P1.6 as external clock source
gTimerA1params.clockSourceDivider = TIMER_A_CLOCKSOURCE_DIVIDER_1; // Divide clock frequency by 1
gTimerA1params.timerInterruptEnable_TAIE = TIMER_A_TAIE_INTERRUPT_DISABLE; // Timer interrupt disabled in TAxCTL Reg
gTimerA1params.timerClear = TIMER_A_DO_CLEAR; // Clear time counter TAxR Reg
gTimerA1params.startTimer = false; // Do not start timer yet.
Timer_A_initContinuousMode(TIMER_A1_BASE, &gTimerA1params);