没有合适的资源?快使用搜索试试~ 我知道了~
电容式触摸按键,献给同行的朋友,加油,大家一起努力
资源推荐
资源详情
资源评论
//******************************************************************************
// Software License Agreement
//
// The software supplied herewith by Microchip Technology
// Incorporated (the "Company") is intended and supplied to you, the
// Company’s customer, for use solely and exclusively on Microchip
// products. The software is owned by the Company and/or its supplier,
// and is protected under applicable copyright laws. All rights are
// reserved. Any use in violation of the foregoing restrictions may
// subject the user to criminal sanctions under applicable laws, as
// well as to civil liability for the breach of the terms and
// conditions of this license.
//
// THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES,
// WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
// TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
// PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
// IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
//
//******************************************************************************
// *****************************************************************************
// Filename: Main727.c
// Date: Dec. 13, 2007
// Purpose: Illustrate the use of the Capacitive Sensing Module
// This program scans 16 pads on a PCB. Each pad is sensed by the Capacitive
// Sensing Module at a fixed interval. The frequency of each pad at rest is averaged.l
// When a pad is touched, the frequency on the Cap. sensing module changes due to the
// extra capacitance from the finger. The change in frequency is noted and the LEDs
// Software License Agreement
//
// The software supplied herewith by Microchip Technology
// Incorporated (the "Company") is intended and supplied to you, the
// Company’s customer, for use solely and exclusively on Microchip
// products. The software is owned by the Company and/or its supplier,
// and is protected under applicable copyright laws. All rights are
// reserved. Any use in violation of the foregoing restrictions may
// subject the user to criminal sanctions under applicable laws, as
// well as to civil liability for the breach of the terms and
// conditions of this license.
//
// THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES,
// WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
// TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
// PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
// IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
//
//******************************************************************************
// *****************************************************************************
// Filename: Main727.c
// Date: Dec. 13, 2007
// Purpose: Illustrate the use of the Capacitive Sensing Module
// This program scans 16 pads on a PCB. Each pad is sensed by the Capacitive
// Sensing Module at a fixed interval. The frequency of each pad at rest is averaged.l
// When a pad is touched, the frequency on the Cap. sensing module changes due to the
// extra capacitance from the finger. The change in frequency is noted and the LEDs
// light up to indicate which button was pressed.
// *****************************************************************************
//
// Compiler: Hi-Tech PIC-C v.9.60
// *****************************************************************************
#include <pic.h>
#include "Cap_Sense.h"
#define METHOD 4 // 1= Timer0 Base; 2= Timer2 Base; 3= WDT base; 4=WDT Sleep Base
#if METHOD == 4
__CONFIG(INTIO & WDTEN & PWRTEN & MCLRDIS & UNPROTECT);
#else
__CONFIG(INTIO & WDTDIS & PWRTEN & MCLRDIS & UNPROTECT);
#endif
/** Variables **/
bank1 unsigned int reading[NUM_BTTNS]; // current reading for each button
bank1 unsigned int average[NUM_BTTNS]; // running average for each button
bank1 unsigned int threshold; // threshold value is req'd # counts decrease from avg
unsigned char index; // index value relates ea. button and scanning sequence
bank2 unsigned int threshold128; // Threshold of 1/128th = 1/128th of the average value
bank2 unsigned int threshold64; // ... used in computation of threshold variable
bank2 unsigned int threshold32; // ... threshold is a selection of the sum of these
// *****************************************************************************
//
// Compiler: Hi-Tech PIC-C v.9.60
// *****************************************************************************
#include <pic.h>
#include "Cap_Sense.h"
#define METHOD 4 // 1= Timer0 Base; 2= Timer2 Base; 3= WDT base; 4=WDT Sleep Base
#if METHOD == 4
__CONFIG(INTIO & WDTEN & PWRTEN & MCLRDIS & UNPROTECT);
#else
__CONFIG(INTIO & WDTDIS & PWRTEN & MCLRDIS & UNPROTECT);
#endif
/** Variables **/
bank1 unsigned int reading[NUM_BTTNS]; // current reading for each button
bank1 unsigned int average[NUM_BTTNS]; // running average for each button
bank1 unsigned int threshold; // threshold value is req'd # counts decrease from avg
unsigned char index; // index value relates ea. button and scanning sequence
bank2 unsigned int threshold128; // Threshold of 1/128th = 1/128th of the average value
bank2 unsigned int threshold64; // ... used in computation of threshold variable
bank2 unsigned int threshold32; // ... threshold is a selection of the sum of these
剩余15页未读,继续阅读
资源评论
hdlikangfei88
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 基于stm32f103c单片机+MPU6050+0.96英寸OLED显示屏双柄遥控器硬件(原理图+PCB)工程文件.zip
- 整理的关于少儿编程的学习路径,以及如何在小升初,初升高和大学充分的利用起来编程经验的优势
- 足球比赛结果统计表2006-2011年大约28W场比赛
- 基于PHP+mysql的社区交流系统(源代码)
- yolov5,SSD 可能使用到的一些代码
- 一键批量生成多层次文件夹结构,使用Python脚本实现嵌套文件夹批量生成
- 基于c51单片机+DS1302+DHT11温湿度模块+LCD1602显示的万年历硬件原理图+BOM+软件程源码序+仿真图.zip
- NSGA2的MATLAB代码
- Messagepassingtest_GCN_DGL.py
- Sh,Docker 运维好帮手,一招通过 sh 脚本批量快速启动和重启多个Docker 容器
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功