新闻中心

EEPW首页>物联网与传感器>设计应用> 电容触摸传感的理论框架

电容触摸传感的理论框架

——
作者:Thomas Perme 微芯科技公司 应用工程师 时间:2009-07-20 来源:电子产品世界 收藏

if (INDEX == 3) {
// 如果扫描结束,则执行以下操作

本文引用地址://m.amcfsurvey.com/article/96399.htm

if (PctArray[0] > PCT_ON) {
// (受影响程度最高的百分比是否大于PCT_ON值?.. 是)

// 按钮被按下
switch(IndxArray[0]) {
case 0: Buttons.BTN0 = 1; // 设置按键的标志
Buttons.BTN1 = 0;
Buttons.BTN2 = 0;
Buttons.BTN3 = 0;
break;
case 1: Buttons.BTN0 = 0;
Buttons.BTN1 = 1;
Buttons.BTN2 = 0;
Buttons.BTN3 = 0;
break;
case 2: Buttons.BTN0 = 0;
Buttons.BTN1 = 0;
Buttons.BTN2 = 1;
Buttons.BTN3 = 0;
break;
case 3: Buttons.BTN0 = 0;
Buttons.BTN1 = 0;
Buttons.BTN2 = 0;
Buttons.BTN3 = 1;
break;
default: break;
}

} else if (PctArray[0] < PCT_OFF) {
// 受影响程度最高的按钮是否高于开路时的程度?
// .. 释放所有按钮。
Buttons.BTN0 = 0;
Buttons.BTN1 = 0;
Buttons.BTN2 = 0;
Buttons.BTN3 = 0;
}

} // 结束:if (INDEX == 3){ , 仅限于完整的扫描



评论


相关推荐

技术专区

关闭