Thanks for your help Mike. When I say that is "unstable" I refer to resolution. To change the sensitivity of the touch I did the following: I change the value of "THRESHOLD_BUTTON1" and I change the sensitivity of touch. // Button 1 button P3.3 const struct Element element1 = { .inputPxselRegister = (uint8_t *) & P3SEL, .inputPxsel2Register = (uint8_t *) & P3SEL2, .inputBits = Bit3, .maxResponse THRESHOLD_BUTTON1 + = 655, .threshold = THRESHOLD_BUTTON1 }; As I increase the clock, I'll decreasing THRESHOLD_BUTTON1. When the clock is high the value of this parameter is very low and detections place undue touches. 1 MHz - baseCnt[0] = 9020 16MHz - baseCnt[0] = 562 my touch settings: const struct Sensor button_1 = { .halDefinition = RO_PINOSC_TA0_WDTp, .numElements = 1, .baseOffset = 0, // Pointer to elements .arrayPtr[0] = &element1, // point to first element // Timer Information .measGateSource= GATE_WDT_SMCLK, // 0->SMCLK, 1-> ACLK //.accumulationCycles= WDTp_GATE_32768 //32768 .accumulationCycles= WDTp_GATE_8192 // 8192 //.accumulationCycles= WDTp_GATE_512 //512 //.accumulationCycles= WDTp_GATE_64 //64 }; my clock settings: void ClockInit(void) { // Set DCO to 8MHz // SMCLK = 8MHz/2 = 4MHz BCSCTL1 = CALBC1_8MHZ; DCOCTL = CALDCO_8MHZ; BCSCTL2 |= DIVS_1; TACCTL0 &= ~CCIE; //BCSCTL2 |= DIVS_3; // VLO = Internal very low power, low frequency oscillator with 12-kHz typical frequency. BCSCTL3 |= LFXT1S_2; // LFXT1 = VLO BCSCTL1 |= DIVA_0; // ACLK/(0:1,1:2,2:4,3:8) }
↧