完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
`我用i2c读取mpr121寄存器0x00的值可以正常读到,但是读取其他寄存器也都是和0x00寄存器一样,按键0-7会产生中断,0x00寄存器得到的值也是对应的。但是8-11按键按下只有中断,0x01的值和0x00寄存器是一样的。如下是初始化设置,求高手指点哪里有问题 // Section A // This group controls filtering when data is > baseline. I2C0_WriteByte(SLAVE_ADDR,0x80, 0x63); I2C0_WriteByte(SLAVE_ADDR,ELE_CFG, 0x00); I2C0_WriteByte(SLAVE_ADDR,0x81, 0xff); I2C0_WriteByte(SLAVE_ADDR,0x82, 0xff); I2C0_WriteByte(SLAVE_ADDR,0x83, 0xff); I2C0_WriteByte(SLAVE_ADDR,0x84, 0xff); I2C0_WriteByte(SLAVE_ADDR,MHD_R, 0x01); I2C0_WriteByte(SLAVE_ADDR,NHD_R, 0x01); I2C0_WriteByte(SLAVE_ADDR,NCL_R, 0x00); I2C0_WriteByte(SLAVE_ADDR,FDL_R, 0x00); // Section B // This group controls filtering when data is < baseline. I2C0_WriteByte(SLAVE_ADDR,MHD_F, 0x01); I2C0_WriteByte(SLAVE_ADDR,NHD_F, 0x01); I2C0_WriteByte(SLAVE_ADDR,NCL_F, 0xff); I2C0_WriteByte(SLAVE_ADDR,FDL_F, 0x00); I2C0_WriteByte(SLAVE_ADDR,0x33, 0x00); I2C0_WriteByte(SLAVE_ADDR,0x34, 0x00); I2C0_WriteByte(SLAVE_ADDR,0x35, 0x00); // Section C // This group sets touch and release thresholds for each electrode I2C0_WriteByte(SLAVE_ADDR,ELE0_T, TOU_THRESH); I2C0_WriteByte(SLAVE_ADDR,ELE0_R, REL_THRESH); I2C0_WriteByte(SLAVE_ADDR,ELE1_T, TOU_THRESH); I2C0_WriteByte(SLAVE_ADDR,ELE1_R, REL_THRESH); I2C0_WriteByte(SLAVE_ADDR,ELE2_T, TOU_THRESH); I2C0_WriteByte(SLAVE_ADDR,ELE2_R, REL_THRESH); I2C0_WriteByte(SLAVE_ADDR,ELE3_T, TOU_THRESH); I2C0_WriteByte(SLAVE_ADDR,ELE3_R, REL_THRESH); I2C0_WriteByte(SLAVE_ADDR,ELE4_T, TOU_THRESH); I2C0_WriteByte(SLAVE_ADDR,ELE4_R, REL_THRESH); I2C0_WriteByte(SLAVE_ADDR,ELE5_T, TOU_THRESH); I2C0_WriteByte(SLAVE_ADDR,ELE5_R, REL_THRESH); I2C0_WriteByte(SLAVE_ADDR,ELE6_T, TOU_THRESH); I2C0_WriteByte(SLAVE_ADDR,ELE6_R, REL_THRESH); I2C0_WriteByte(SLAVE_ADDR,ELE7_T, TOU_THRESH); I2C0_WriteByte(SLAVE_ADDR,ELE7_R, REL_THRESH); I2C0_WriteByte(SLAVE_ADDR,ELE8_T, TOU_THRESH); I2C0_WriteByte(SLAVE_ADDR,ELE8_R, REL_THRESH); I2C0_WriteByte(SLAVE_ADDR,ELE9_T, TOU_THRESH); I2C0_WriteByte(SLAVE_ADDR,ELE9_R, REL_THRESH); I2C0_WriteByte(SLAVE_ADDR,ELE10_T, TOU_THRESH); I2C0_WriteByte(SLAVE_ADDR,ELE10_R, REL_THRESH); I2C0_WriteByte(SLAVE_ADDR,ELE11_T, TOU_THRESH); I2C0_WriteByte(SLAVE_ADDR,ELE11_R, REL_THRESH); I2C0_WriteByte(SLAVE_ADDR,0x5b, 0x00); I2C0_WriteByte(SLAVE_ADDR,0x5c, 0x10); I2C0_WriteByte(SLAVE_ADDR,0x5d, 0x24); I2C0_WriteByte(SLAVE_ADDR,0x7b, 0x0b); I2C0_WriteByte(SLAVE_ADDR,0x7c, 0x00); I2C0_WriteByte(SLAVE_ADDR,0x7d, 0xc8); I2C0_WriteByte(SLAVE_ADDR,0x7e, 0x82); I2C0_WriteByte(SLAVE_ADDR,0x7f, 0xb4); // Section D // Set the Filter Configuration // Set ESI2 I2C0_WriteByte(SLAVE_ADDR,FIL_CFG, 0x04); // Section E // Electrode Configuration // Enable 6 Electrodes and set to run mode // Set ELE_CFG to 0x00 to return to standby mode I2C0_WriteByte(SLAVE_ADDR,ELE_CFG, 0xbC);// Enables all 12 Electrodes 下图是抓取访问0x41寄存器的波形,run模式前设置的阈值时0x0f,正常读取的应该是常值,但是读取情况也和0x00寄存器一样,即0-7按键值。 ` |
|
相关推荐
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
806 浏览 0 评论
5158 浏览 0 评论
如何使用python调起UDE STK5.2进行下载自动化下载呢?
2666 浏览 0 评论
开启全新AI时代 智能嵌入式系统快速发展——“第六届国产嵌入式操作系统技术与产业发展论坛”圆满结束
3008 浏览 0 评论
获奖公布!2024 RT-Thread全球巡回线下培训火热来袭!报名提问有奖!
32178 浏览 11 评论
73219 浏览 21 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-27 09:14 , Processed in 0.599099 second(s), Total 68, Slave 50 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号