完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,
我试图让lsm303c在INT_XL引脚上输出“低电平有效”中断。 这是我的初始代码: void LSM303C_AccInit(void) { uint8_t result = 0; ACCELERO_IO_Write(LSM303C_CTRL_REG1_A,0b00100101); //禁用y轴以避免mg ACCELERO_IO_Write(LSM303C_CTRL_REG2_A,0b00000000); ACCELERO_IO_Write(LSM303C_CTRL_REG3_A,0b00001000); ACCELERO_IO_Write(LSM303C_CTRL_REG4_A,0b00000000); ACCELERO_IO_Write(LSM303C_CTRL_REG5_A,0b00000011); //中断低电平有效,开漏 ACCELERO_IO_Write(LSM303C_FIFO_CTRL,0b01000000); //流模式 ACCELERO_IO_Write(LSM303C_IG_CFG1_A,0b11100010); // y中断禁用 ACCELERO_IO_Write(LSM303C_IG_THS_X1_A,5); ACCELERO_IO_Write(LSM303C_IG_THS_Y1_A,5); ACCELERO_IO_Write(LSM303C_IG_THS_Z1_A,5); ACCELERO_IO_Write(LSM303C_IG_DUR1_A,0b10000001); //中断延迟 } 嵌入式控制器的引脚配置为弱上拉输入。 示波器显示出对加速的良好中断反应,但不是我配置的:没有中断时INT_XL为低电平,但一旦检测到加速度,信号就会变为高电平约40ms然后再次回到低电平状态。 我究竟做错了什么? 谢谢, 吉尔 以上来自于谷歌翻译 以下为原文 Hi, I am trying to get lsm303c output an "active low" interrupt on pin INT_XL. here is my init code: void LSM303C_AccInit(void) { uint8_t result = 0; ACCELERO_IO_Write(LSM303C_CTRL_REG1_A, 0b00100101); // disable y axis to avoid mg ACCELERO_IO_Write(LSM303C_CTRL_REG2_A, 0b00000000); ACCELERO_IO_Write(LSM303C_CTRL_REG3_A, 0b00001000); ACCELERO_IO_Write(LSM303C_CTRL_REG4_A, 0b00000000); ACCELERO_IO_Write(LSM303C_CTRL_REG5_A, 0b00000011); //interrupt active low, open-drain ACCELERO_IO_Write(LSM303C_FIFO_CTRL, 0b01000000); //stream mode, ACCELERO_IO_Write(LSM303C_IG_CFG1_A, 0b11100010); //y interrupt disabled ACCELERO_IO_Write(LSM303C_IG_THS_X1_A, 5); ACCELERO_IO_Write(LSM303C_IG_THS_Y1_A, 5); ACCELERO_IO_Write(LSM303C_IG_THS_Z1_A, 5); ACCELERO_IO_Write(LSM303C_IG_DUR1_A, 0b10000001); //interrupt delay } The embedded controller's pin is configured as input with weak pull up. The oscilloscope shows a good interrupt reaction to acceleration, but not as i configured it: the INT_XL is low when no interrupt, but as soon as there is acceleration detected, the signal goes high for about 40ms and then goes back to low again forever. What am i doing wrong? Thanks, Gil |
|
相关推荐
1个回答
|
|
以下配置不正确:
ACCELERO_IO_Write(LSM303C_IG_CFG1_A,0b11100010); // y中断禁用 如果需要AND组合,请将AOI位设置为1;如果需要OR,请将其设置为0并设置 6D位为0。 以上来自于谷歌翻译 以下为原文 Following configuration is not correct: ACCELERO_IO_Write(LSM303C_IG_CFG1_A, 0b11100010); //y interrupt disabled Please set the AOI bit to 1 if you want AND combination or to 0 if you want OR and set the 6D bit to 0. |
|
|
|
只有小组成员才能发言,加入小组>>
请教:在使用UDE STK时,单片机使用SPC560D30L1,在配置文件怎么设置或选择?里面只有SPC560D40的选项
2738 浏览 1 评论
3241 浏览 1 评论
请问是否有通过UART连接的两个微处理器之间实现双向值交换的方法?
1810 浏览 1 评论
3650 浏览 6 评论
6039 浏览 21 评论
1339浏览 4评论
201浏览 3评论
对H747I-DISCO写程序时将CN2的st-link复用为usart1,再次烧录时无法检测到stlink怎么解决?
353浏览 2评论
STM32G474RE芯片只是串口发个数据就发烫严重是怎么回事?
444浏览 2评论
STM32处理增量式编码器Z信号如何判断中断是正转的还是反向转的?
274浏览 2评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-25 04:29 , Processed in 1.107466 second(s), Total 76, Slave 60 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号