完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我正在使用IIS2DH accelorometer我想配置单/双击点击检测。为此,我做了以下配置:
I2C_WriteByte(安培; ctrl_1,1,0x5F); I2C_WriteByte(安培; ctrl_3,1,0x80); I2C_WriteByte(安培; ctrl_6,1,0x82); I2C_WriteByte(安培; ctrl_4,1,0x00); I2C_WriteByte(安培; int1_config,1,0x00); I2C_WriteByte(安培; ctrl_5,1,0x40); I2C_WriteByte(安培; click_config,1,0x15); 我阅读点击源寄存器进行单击检测,但每次值都不同。此外,没有为微控制器设置中断标志。我的配置中是否有任何错误? 是否有针对IIS2DH的应用笔记(DM00171283)? 以上来自于谷歌翻译 以下为原文 I am working with IIS2DH accelorometer an I would like to configure single/double click tap detection. For that, I have done following configuration: I2C_WriteByte(&ctrl_1,1,0x5F); I2C_WriteByte(&ctrl_3,1,0x80); I2C_WriteByte(&ctrl_6,1,0x82); I2C_WriteByte(&ctrl_4,1,0x00); I2C_WriteByte(&int1_config,1,0x00); I2C_WriteByte(&ctrl_5,1,0x40); I2C_WriteByte(&click_config,1,0x15); I read click source register for single click detection but values are different every time. Also,interrupt flag not set for microcontoller.Is there any thing need to be wrong in my configuration? Is any application note for IIS2DH(DM00171283)? |
|
相关推荐
6个回答
|
|
您的配置是正确的,但您还必须为单击检测设置两个配置寄存器(CLICK_THS,TIME_LIMIT)。
如果设备配置为单击事件检测,则当所选通道上的输入加速度超过设定的阈值CLICK_THS时会产生中断,并在TIME_LIMIT寄存器定义的时间窗口内返回低于此值的中断。 以上来自于谷歌翻译 以下为原文 You configuration is correct, but you have to set also two configuration registers for single click detection (CLICK_THS, TIME_LIMIT). If the device is configured for single-click event detection, an interrupt is generated when the input acceleration on the selected channel exceeds the programmed threshold CLICK_THS, and returns below it within a time window defined by the TIME_LIMIT register. |
|
|
|
I2C_WriteByte(安培; ctrl_1,1,0x5F);
I2C_WriteByte(安培; ctrl_3,1,0x80); I2C_WriteByte(安培; ctrl_6,1,0x82); I2C_WriteByte(安培; ctrl_4,1,0x00); I2C_WriteByte(安培; int1_config,1,0x00); I2C_WriteByte(安培; ctrl_5,1,0x40); I2C_WriteByte(& click_config,1,0x01); //仅x轴单击启用 I2C_WriteByte(安培;的时限,1,0x05); I2C_WriteByte(安培; click_ths,1,0x0D); 我已经配置了上面的寄存器并且我连续读取了点击源寄存器但是当我点击加速度计中断生成并且点击来自传感器的源值是从该值得到的0x09,0x01,0x51我认为只有0x51是正确的以匹配唯一的X轴启用检测,而形成另外两个值,我也得到了中断。我的配置是否正确?我还有一个查询,在上面的配置time_limit和 click_ths 寄存器,我加载了0x05和0x0d,这意味着经过多少时间和多少加速后它产生中断?所以,可以帮我解决这个问题。感谢您的支持。 以上来自于谷歌翻译 以下为原文 I2C_WriteByte(&ctrl_1,1,0x5F); I2C_WriteByte(&ctrl_3,1,0x80); I2C_WriteByte(&ctrl_6,1,0x82); I2C_WriteByte(&ctrl_4,1,0x00); I2C_WriteByte(&int1_config,1,0x00); I2C_WriteByte(&ctrl_5,1,0x40); I2C_WriteByte(&click_config,1,0x01);//only x axis click enable I2C_WriteByte(&time_limit,1,0x05); I2C_WriteByte(&click_ths,1,0x0D); I have configured above registers and I read click source register continuously but when I click the accelerometer interrupt is generated and click source values is getting from sensor is 0x09,0x01,0x51 from that value I thought only 0x51 is correct to match with the only X axis enable detection whereas, form the other two values, I had got the interrupt as well. Am I done correct configuration? and I have one more query that in above configuration time_limit and click_ths register,I have load with 0x05 and 0x0d that means after how much time and after how much acceleration it generate the interrupt?So, could help me on that issue. Thank you for your support. |
|
|
|
你好,
我才发现这个 http://www.st.com/content/st_com/en/resource-selector.html (无法搜索比2015年9月7日更旧的文档): http://www.st.com/content/ccc/resource/technical/document/application_note/17/c9/44/8d/ff/25/4e/1f/CD00163557.pdf/files/CD00163557.pdf/jcr:内容/翻译/ en.CD00163557.pdf 还有一个是谷歌发现的 http://www.st.com/content/ccc/resource/technical/document/application_note/b4/d6/a1/42/8a/d1/4e/05/CD00196199.pdf/files/CD00196199.pdf/jcr:内容/翻译/ en.CD00196199.pdf 由于文件似乎很相似,我会尝试阅读其中的操作理论。 Batek.Miroslav “是否有针对较新设备的类似应用说明?大卫 注意:原始帖子包含大量线程对话,只能迁移到第9级 以上来自于谷歌翻译 以下为原文 Hello, I only found this in http://www.st.com/content/st_com/en/resource-selector.html (can't search for older documents than September 7th, 2015) : http://www.st.com/content/ccc/resource/technical/document/application_note/17/c9/44/8d/ff/25/4e/1f/CD00163557.pdf/files/CD00163557.pdf/jcr:content/translations/en.CD00163557.pdf And one more discovered by Google http://www.st.com/content/ccc/resource/technical/document/application_note/b4/d6/a1/42/8a/d1/4e/05/CD00196199.pdf/files/CD00196199.pdf/jcr:content/translations/en.CD00196199.pdf Since the documents seem pretty similar, I would try to read the theory of operation in them. Batek.Miroslav ‌, is there a similar application note for newer devices?David Note: the original post contained a large number of threaded conversations and was only able to be migrated to the 9th level |
|
|
|
还有一件事我想在数据表中告诉你
的 DM00171283在点击源寄存器中没有像LIR这样的位。那么,如何使用和配置该注册表进行单击检测?此外,我以前的查询仍未得到解答。我点击一下就得到了中断,但我只点击了一次,中断得到了多次。请为此提供适当的指导。 以上来自于谷歌翻译 以下为原文 One more thing I would like to tell you that in the datasheet of DM00171283 there are no such bit like LIR in the click source register. So, how to use and configure that register for single click detection? Furthermore, my previous query still not be answered. I got the interrupt on single click but I only click one time, interrupt got multiple time. Please provide proper guidance for that. |
|
|
|
感谢您的特别支持。
I2C_WriteByte(安培; ctrl_1,1,0x5F); I2C_WriteByte(安培; ctrl_3,1,0x80); I2C_WriteByte(安培; ctrl_6,1,0x82); I2C_WriteByte(& ctrl_4,1,0x20); // 8g灵敏度设置 I2C_WriteByte(安培; int1_config,1,0x00); I2C_WriteByte(安培; ctrl_5,1,0x40); I2C_WriteByte(& click_config,1,0x15); // x,y,z,单击启用 I2C_WriteByte(安培;的时限,1,0x05); I2C_WriteByte(& click_ths,1,0x60);根据您的回答,我按照上述规范配置了所有寄存器。此外,我使用IA位屏蔽中断生成,在我的代码中我连续读取点击源寄存器,一旦IA位置位,我已经读取了x,y和z轴值,并且我已经读取了以下内容。这还不错?此外,有时我有多次设置IA位单击。那么,任何解决这个问题的方法呢?现在,它工作得非常好。 点击src 54 x轴是9 y轴是-8 z轴是55 ****************** 点击src 54 x轴为-4 y轴是32 z轴为-5 ****************** 点击src 54 x轴为-12 y轴是-25 z轴是80 ****************** 点击src 5a x轴为-7 y轴是66 z轴是127 ****************** 点击src 54 x轴为-2 y轴是-24 z轴是81 ****************** 点击src 5c x轴为-9 y轴是-84 z轴是77 ****************** 点击src 54 x轴是2 y轴是7 z轴是34 ****************** 点击src 52 x轴是4 y轴是12 z轴是-6 ****************** 点击src 52 x轴为-1 y轴是15 z轴是-6 ****************** 点击src 52 x轴为1 y轴是6 z轴为0 ******************我点击特定的硬件,然后我得到了IA位设置,但如果我点击硬件,没有任何事情发生。那么,硬件周围的任何特定区域都可以点击并获得中断? 以上来自于谷歌翻译 以下为原文 Thank you for your exceptional support. I2C_WriteByte(&ctrl_1,1,0x5F); I2C_WriteByte(&ctrl_3,1,0x80); I2C_WriteByte(&ctrl_6,1,0x82); I2C_WriteByte(&ctrl_4,1,0x20);// 8g sensitivity set I2C_WriteByte(&int1_config,1,0x00); I2C_WriteByte(&ctrl_5,1,0x40); I2C_WriteByte(&click_config,1,0x15);//x,y,z, enable for click I2C_WriteByte(&time_limit,1,0x05); I2C_WriteByte(&click_ths,1,0x60);As per your answer, I have configured all registers as per above specification. Moreover, I have used IA bit to mask for interrupt generation, in my code I have continuously read click source register and once IA bit is set I have read x,y, and z axis value and following reading I have got. It is fine or not? Furthermore, sometimes I have got multiple time IA bit set for single click. So, any method to overcome this issue? Now, it is working very fine. click src 54 x axis is 9 y axis is -8 z axis is 55 ****************** click src 54 x axis is -4 y axis is 32 z axis is -5 ****************** click src 54 x axis is -12 y axis is -25 z axis is 80 ****************** click src 5a x axis is -7 y axis is 66 z axis is 127 ****************** click src 54 x axis is -2 y axis is -24 z axis is 81 ****************** click src 5c x axis is -9 y axis is -84 z axis is 77 ****************** click src 54 x axis is 2 y axis is 7 z axis is 34 ****************** click src 52 x axis is 4 y axis is 12 z axis is -6 ****************** click src 52 x axis is -1 y axis is 15 z axis is -6 ****************** click src 52 x axis is 1 y axis is 6 z axis is 0 ******************I tap on particular hardware then I got the IA bit set but if I tap around the hardware nothing can happened. So, any specific region around the hardware to tap and got the interrupt? |
|
|
|
您好Miroslav,我通过使用硬件中断和IA位屏蔽单击了这两种方法。它工作正常。但是,当我使用硬件中断然后一旦中断激活并且我正在读取点击源寄存器,有时它显示如下的值:
点击src 2 x轴为-7 y轴是-4 z轴是31 ****************** 点击src 5a x轴为-17 y轴是-11 z轴是45 ****************** 点击src 1 x轴为-28 y轴为-13 z轴是73 ******************点击src a x轴为-4 y轴是5 z轴是15 ******************所以,在像0x02,0x01,0x0a这样的情况下,IA位为0表示中断未激活,那么硬件中断是如何激活的?我可以同时使用两种条件来检查中断是否有效?防爆。 如果(hw_interrupt_flag) { if(click_source&amp;(1&lt;&lt; 6) { 打印('单击检测'); } } 还有一个问题是你告诉我使用软件过滤器来解决多点击检测问题,那么我是如何实现的呢? 感谢您的支持。 以上来自于谷歌翻译 以下为原文 Hi Miroslav, I have done single click on both method by using hardware interrupt and IA bit masking. it is working fine. However, when I used hardware interrupt then once interrupt is active and I am reading click source register, sometimes it is shown value like below: click src 2 x axis is -7 y axis is -4 z axis is 31 ****************** click src 5a x axis is -17 y axis is -11 z axis is 45 ****************** click src 1 x axis is -28 y axis is -13 z axis is 73 ******************click src a x axis is -4 y axis is 5 z axis is 15 ******************So, in the case like 0x02,0x01,0x0a IA bit is 0 means that interrupt is not active then how the hardware interrupt is activated? Can I use both condition to check interrupt is active or not? Ex. if(hw_interrupt_flag) { if(click_source & (1<<6) { print('single click detect'); } } One more concern is you told that multiple click detection issue is solved by using software filter so, how I achieve it? Thanks for your support. |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2644 浏览 1 评论
3209 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1784 浏览 1 评论
3613 浏览 6 评论
5990 浏览 21 评论
940浏览 4评论
1317浏览 4评论
在Linux上安装Atollic TRUEStudio的步骤有哪些呢?
585浏览 3评论
使用DMA激活某些外设会以导致外设无法工作的方式生成代码是怎么回事
1304浏览 3评论
1362浏览 3评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-25 22:27 , Processed in 1.335590 second(s), Total 110, Slave 93 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号