完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
我将在下一篇文章中上传我的项目,但这给我的代码带来了一个问题。
响应= LIS3DHYGETACACXESRAW(和数据);//TM读取和打印原始AccEL数据 如果(响应=1){ //打印数据值 sprintf(strmsg1,“XX = % 6d yy = % 6d ZZ = % 6d rn”(data.axis_x >;>;6),(data.axis_y >;>;6),(data.axis_z >;>;6)); SCBY1UARTEPSTROST(STRMSG1); } sprintf(strmsg1,“x = y = % % 6d 6d Z = % 6d rn”(rawaccel [ 0 ] [ 0 ]),(rawaccel [ 1 ] [ 0 ]),(rawaccel [ 2 ] [ 0 ])); 数据读取,如xx=-12 yy=7 ZZ=244 但同样的代码在185在isr_1。C可以填充数组变量rawaccel [ 0 ] [ 0 ] [ 2 ] [ 0 ] .. 响应= lis3dh_getaccaxesraw(&;数据);// TM原加速数据读取和存储 如果(响应=1){ Ledix 2x写(1); 拉瓦塞尔〔0〕〔0〕=DATA AxISxx; 拉瓦塞尔〔1〕〔0〕=DATA AxISSY; 拉瓦塞尔〔2〕〔0〕=DATA AxISSZ Z; } 这应该是打印出来的204行(最后一行以上代码中)但是它不产生任何数据,打印线从来都是零。原始的加速度数据应该是12位左对齐存储在项目中。我已经证明,在ISR代码,我得到1的响应因为LED2亮起来。这可能是我在所有的文件共享变量的方式。 我很感激你们的指导。 以上来自于百度翻译 以下为原文 I will upload my project in the next post but it's giving me a problem in that code that works in main.c doesn't work in isr_1.c, specifically the code starting at line 198 in main.c response = LIS3DH_GetAccAxesRaw(&data); // TM read and print Raw Accel data if(response==1){ //print data values sprintf(strMsg1, "Xx=%6d Yy=%6d Zz=%6d rn", (data.AXIS_X >> 6), (data.AXIS_Y >> 6), (data.AXIS_Z >> 6) ); SCB_1_UartPutString(strMsg1); } sprintf(strMsg1, "X=%6d Y=%6d Z=%6d rn", (rawAccel[0][0]), (rawAccel[1][0]), (rawAccel[2][0])); Works with data read out like Xx= -12 Yy= 7 Zz= 244 but the same code at ine 185 in isr_1.c is supposed to populate the array variable rawAccel[0][0]..[2][0] response = LIS3DH_GetAccAxesRaw(&data); // TM read and store Raw Accel data if(response==1){ LED_2_Write(1); rawAccel[0][0] = data.AXIS_X; rawAccel[1][0] = data.AXIS_Y; rawAccel[2][0] = data.AXIS_Z; } which is supposed to be printed out by line 204 (the last line in the code above) but it doesn't produce any data, the printed line is always all zeros. The raw accelerometer data is supposed to be 12 bits left justified stored in a int16. I've proved that, in the ISR code, I'm getting a 1 for the response because LED2 lights up. This may be the way I'm trying to share variables across all the files. I'd appreciate any guidance you guys may have. |
|
相关推荐
1个回答
|
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
788个成员聚集在这个小组
加入小组cyUSB3014一直显示2.1,不能到3.0情况,谁遇到过
7459 浏览 0 评论
2492 浏览 1 评论
2184 浏览 1 评论
4046 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
2095 浏览 6 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
7948浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
6520浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
760浏览 2评论
736浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
8372浏览 2评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-17 19:42 , Processed in 0.970003 second(s), Total 71, Slave 54 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
397