📄 main.c
字号:
//******************************************************************************
// RO method capactiance measurement using CompA+, TimerA0, and WDT+
// Schematic Description of CompA+ forming relaxation oscillator and
// coupling (connection) between the relaxation oscillator and TimerA0.
// <- Output
// -> Input
// R Resistor (typically 100Kohms)
//
// MSP430F2011
// +---------------+
//
// +--<P1.6
// |
// R
// |
// +---+-->P1.1/CA1
// | |
// R R
// | |
// GND +-->P1.0/TACLK
// |
// c-+-----------+-R--+--<P1.7/CAOUT
// | |
// | c-+-------+-R--+
// | | |
// | | c-+-----R--+
// | | | |
// | | | c-+-R--+
// | | | |
// | | | +------->P1.5/CA5
// | | +----------->P1.4/CA4
// | +--------------->P1.3/CA3
// +------------------->P1.2/CA2
//
// The WDT+ interval represents the measurement window. The number of
// counts within the TA0R that have accumulated during the measurement
// window represents the capacitance of the element. Using the WDT is
// a low power implementation, either LPM3 (when WDT+ is sourced from
// ACLK) or LPM0 (when WDT+ sourced from SMCLK).
//
//******************************************************************************
#include "CTS_Layer.h"
unsigned int position;
//unsigned int dCnt[4];
// Main Function
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
// establish baseline
TI_CAPT_Init_Baseline(&slider);
TI_CAPT_Update_Baseline(&slider,5);
// Main loop starts here
while (1)
{
position = TI_CAPT_Slider(&slider);
//TI_CAPT_Custom(&slider,dCnt);
if(position != ILLEGAL_SLIDER_WHEEL_POSITION)
{
__no_operation();
}
__delay_cycles(100);
}
} // End Main
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -