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 #405 background imageLoading...
Page #405 background image
405
Explanation
This example uses the same ideas as in the previous example. The header file is slightly modified.
Three sensor elements are used and so the number of sensor is set 3. The elements are named
differently since each are independent of the other.
extern const struct Element middle_element;
extern const struct Element up_element;
extern const struct Element down_element;
// Identify all sensors defined in structure.c
extern const struct Sensor multi_buttons;
//****** RAM ALLOCATION ********************************************************
// TOTAL_NUMBER_OF_ELEMENTS represents the total number of elements used, even if
// they are going to be segmented into seperate groups. This defines the
// RAM allocation for the baseline tracking. If only the TI_CAPT_Raw function
// is used, then this definition should be removed to conserve RAM space.
#define TOTAL_NUMBER_OF_ELEMENTS 3
....
//****** Structure Array Definition ********************************************
// This defines the array size in the sensor strucure. In the event that
// RAM_FOR_FLASH is defined, then this also defines the amount of RAM space
// allocated (global variable) for computations.
#define MAXIMUM_NUMBER_OF_ELEMENTS_PER_SENSOR 3
The main difference is present in the structure source file. The three different elements are declared
independently despite being in the same port. This is so because we need to identify them when a
touch is detected.
const struct Element middle_element = {
.inputPxselRegister = (unsigned char *)&P2SEL,
.inputPxsel2Register = (unsigned char *)&P2SEL2,
.inputBits = BIT5,
// When using an abstracted function to measure the element
// the 100*(maxResponse - threshold) < 0xFFFF
// ie maxResponse - threshold < 655
.maxResponse = (100 + 655),
.threshold = 100
};
// Up Element (P2.4)
const struct Element up_element = {
.inputPxselRegister = (unsigned char *)&P2SEL,
.inputPxsel2Register = (unsigned char *)&P2SEL2,
.inputBits = BIT4,
// When using an abstracted function to measure the element
// the 100*(maxResponse - threshold) < 0xFFFF
// ie maxResponse - threshold < 655
.maxResponse = (100 + 655),
.threshold = 100
};
// Down Element (P2.3)

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