EasyManuals Logo
Home>Texas Instruments>Microcontrollers>MSP430

Texas Instruments MSP430 User Manual

Texas Instruments MSP430
413 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #397 background imageLoading...
Page #397 background image
397
{
.halDefinition = RO_PINOSC_TA0_WDTp, // Sensing Method
.numElements = 1, // # of Elements
.baseOffset = 0, // First element index = 0
// Pointer to elements
.arrayPtr[0] = &middle_element, // point to middle element
// Timer Information
.measGateSource= GATE_WDT_ACLK, // 0->SMCLK, 1-> ACLK
.accumulationCycles= WDTp_GATE_64 //64 - Default
};
The second part of the source file details which method is used along with the name and number of
element(s) to sense. Basically, here we have nothing to do other than to let this part know the
structure name of our element(s) and the number of sensors.
#pragma vector = TIMER0_A0_VECTOR
__interrupt void ISR_Timer0_A0(void)
{
TA0CTL &= ~MC_1;
TA0CCTL0 &= ~(CCIE);
__bic_SR_register_on_exit(LPM3_bits + GIE);
}
#pragma vector = PORT2_VECTOR, \
PORT1_VECTOR, \
TIMER0_A1_VECTOR, \
USI_VECTOR, \
NMI_VECTOR,COMPARATORA_VECTOR, \
ADC10_VECTOR
__interrupt void ISR_trap(void)
{
// the following will cause an access violation which results in a PUC reset
WDTCTL = 0;
}
Two interrupts are needed to be called. The first is the Timer0_A ISR. This acts like a wakeup alarm.
Once the capacitive sensing and other tasks in the main loop are completed, this timer is started and
low power mode is entered. After timeout, this timer interrupts causing the main tasks to reoccur and
leave low power mode momentarily. The second is a Trap ISR. Trap ISR ensures that if for some reason
something happens that you didn’t expect it will reset the MCU. The interrupt vectors assigned here
are those vectors which we won’t be using. If any of these pop-up, a reset will occur.
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
GPIO_graceInit();
BCSplus_graceInit();
TI_CAPT_Init_Baseline(&one_button);
TI_CAPT_Update_Baseline(&one_button, 6);
while (1)
{
if(TI_CAPT_Button(&one_button))

Table of Contents

Other manuals for Texas Instruments MSP430

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments MSP430 and is the answer not in the manual?

Texas Instruments MSP430 Specifications

General IconGeneral
BrandTexas Instruments
ModelMSP430
CategoryMicrocontrollers
LanguageEnglish

Related product manuals