完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嘿,我有我的捕获代码。我相信我的捕获是正确的,但我想是我决定结果和输出我有一个问题。我正试图监测一个轴的速度(目前连接在一个演习的测试)我的捕获有溢出,因为速度太慢,以获得捕获没有time1翼(见附件),所以当我捕获数据并把溢出数增加到一个24位数字的低速时,当我期望数字接近恒定速度时,我得到了一个巨大的范围。请帮助我,因为我已经在这个问题上停留了很长时间了。杰森?
以上来自于百度翻译 以下为原文 Hey all, I'm having an isue with my capture code. I believe my capture is working correctly but I think its the was I determine the results and output I'm having an issue with. I'm trying to monitor a speed of a shaft (Currently connected on a Drill for test) My Capture has an overflow as the speed is too slow to get a capture without timer1 overflowing. (See attachment) So when I'm capturing the data and putting the overflow number to increase the timervalue to a 24bit Number At low speeds I get a massive range when I expect the number to be closer bue to the constant speed. Please help as I've been stuck on this for ages?? jason Attached Image(s) |
|
相关推荐
6个回答
|
|
另外,我认为这是与MSB和LSB有关的……但无法解决吗?
以上来自于百度翻译 以下为原文 Additional; I think it's to do with MSB & LSB... but unable to work it out? |
|
|
|
嗨,你觉得论坛上的人能猜出你用的是哪一张照片吗?1200个?如果你需要一些帮助,请给出细节:PIC?编译器?你的程序?当做
以上来自于百度翻译 以下为原文 Hi, Do you think people on this forum can guess which PIC you're using ...out of 1200 ? If you want some help give details : PIC?, compiler?, your program? Regards |
|
|
|
RISC,对不起,我的问题更多的是关于数据和数据解释。但是,在这里……PIC18F4680C18MPLAB IDV863i AM设置ECP1作为捕获,在我的中断期间,在我的CAN TxMy可以监视正在读取;can MexGe 0x4fByb顺序:Moto LoalStand(BIT):16STARTBIT:8.我希望这能帮助你回答我关于MSB和LSB的问题吗?我的抓捕工作很好,但似乎并不稳定(我想)杰森
以上来自于百度翻译 以下为原文 RISC, Sorry, my question was more about the data and the data interpretation. but, here you go... PIC18F4680 C18 MPLAB IDE v8.63 I am setting up the ECCP1 as a capture, During my interrupt // Overflow on Tmr1 if (PIR1bits.TMR1IF) { Tmr1OrFlw++; PIR1bits.TMR1IF = 0; } // Capture on pin RD4 if (PIR2bits.ECCP1IF) { TMR1H = 0x00; TMR1L = 0X00; Tmr1OrFlwResult = Tmr1OrFlw; Tmr1OrFlw = 0x00; PIR2bits.ECCP1IF = 0; // clear in sw PIR2 = 0x00; // Above line doesn't seem to work on it own? } } Then during my CAN Tx if (tTimer_MPH_Data >= Timer_25mS) { tTimer_MPH_Data=0; iTXAttempts= 1; // Try to send once before calling it a day ID = 0x4F; // Clear down the CAN buffers-------------// data[0] = Tmr1OrFlwResult; data[1] = ECCPR1H; data[2] = ECCPR1L; data[3] = Tmr1OrFlw; while ((!ECANSendMessage(ID,data,4,ECAN_TX_STD_FRAME))&& iTXAttempts!=0) // If failed... iTXAttempts--; } My CAN monitoring is reading the; CAN Messgae 0x4F Byte Order : Motorola Length (bit) : 16 Startbit : 8 I hope this helps you answer my question about is the MSB and LSB in the correct order? My Capture is working fine but just doesn't seem to be stable (I think) Jason |
|
|
|
嗨,你为什么使用这些旧的软件工具(C18和MPLAB)?两者都是至少6岁……已经被XC8和MPLAB X取代。对于捕获,最重要的是确保一些捕获没有丢失或溢出……那么,你最小的捕获量是多少?你确信你有足够的时间处理它直到下一个到来吗?你有没有其他的中断比你所展示的?你声明你的中断变量是不稳定的吗?你有没有想过如果捕获中断发生在下面的2行之间会发生什么?你的中断总是在主程序中同时启用还是有时会使其中之一中断?如果你将其中之一禁用,则必须将中断标志测试更改为:
以上来自于百度翻译 以下为原文 Hi, Why do you use such old software tools (C18 & MPLAB). Both are at least 6 years old...and have been replaced by XC8 and MPLAB X. Regarding capture, the most important is to make sure that some capture is not missed or overflowing... So what is your smallest capture ? Are you sure you have enough time to process it until the next one comes ? Do you have other interrupts than the ones you have shown ? Did you declare your interrupt variables as volatile ? Have you thought about what would happen if the capture interrupt happens in between 2 lines below... data[1] = ECCPR1H; //what happen if capture interrupt takes place here... data[2] = ECCPR1L; Are your interrupt always enabled simultaneously in you main program or do you sometimes diable one of them ? If you diable one of them then you must change your interrupt flag tests to this : if (PIE1bits.TMR1IE && PIR1bits.TMR1IF) ... if (PIE2bits.EECP1IE && PIR2bits.ECCP1IF) .... Regards |
|
|
|
感谢RISCI还没有更新,因为我的项目已经花了很长时间。我10年前开始的,2年前把它捡回来了。再一次,我的婚礼结束了,孩子们又停了下来,但在过去的几个月里,我又开始了。我的计划是,当我的项目完成后,我想更新一张新的照片,然后我会更新我的环境。我已经有了ICD3,所以只要坚持我所知道的,给我时间,我会赶上你们的!不,因为我不更新酒徒的变数。我直接从寄存器中读取ECCPR1H和ECCPR1L,我很不走运。当我对它进行测试时,我会看到发生了什么,我每25Ms发送结果,所以所有的捕获都被忽略了。当我得到捕捉工作,我会确保它不会大规模跳出结果,因为这是不可能的。它应该是一个平滑的增加和减少的时间。我已经写了软件,所以它溢出。溢出允许捕获成为24位数字而不是16位。我确实提前完成了所有的定时,但是这里没有计算。捕获是我车上的驱动轴(一个旋转- 1捕获),所以它的速度最慢的是1MPH,最快的速度是150英里/小时。我想重新计算,并寻求在捕获和相关速度之间转换的帮助。但首先会提供更多的细节。杰森
以上来自于百度翻译 以下为原文 Thanks RISC I haven't updated yet because the project I've been working on has taken a long time. I started it 10 years ago and picked it back up 2 years ago. Again, life took over with my wedding and kids I stopped again but started it again over the last few months and I'm nearly finished. My plan is when my project is completed I want to update to a newer PIC, and then I'll update my environment. I've already got a ICD3 so just keeping to what I know, Give me time and I'll catch you guys up! No because I don't update the variable in the inturrupt. I read the ECCPR1H and ECCPR1L directly from the register. I would be very unlucky....... when i test it live, I'll see what happens, I am sending the result out every 25mS so all the captures inbetween are ignored. When I get the capture working I will make sure it doesn't massively jump from results because this will not be possiible. It should be a smooth increase and decrease in time. I have wrote the software so it does overflow. The overflow allows the capture to become a 24bit Number instead of a 16bit. I did work out all the timing previosuly but do not have my calculations here. The capture is my driveshaft on my car (one rotation - 1 capture) So the slowest it would be is at 1mph and the fastest would be ~150mph. I want to re-do the calculations and ask for help on the conversion between the capture and related speed. but will supply more details on that on first. Jason |
|
|
|
所有这一切都解决了——我发现SGAFT上的磁铁放置错了-导致阅读中的变体。读数实际上是正确的,1磁铁的开关比另一磁铁快。谢谢你的帮助。
以上来自于百度翻译 以下为原文 All. This is resolved - I identified that the magnets on the sgaft was misplaced - causing the variants in the reading. The reading was actually correct and the 1 magnet was switching quicker then the other magnet. Thank for your help |
|
|
|
只有小组成员才能发言,加入小组>>
5362 浏览 9 评论
2093 浏览 8 评论
1992 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3274 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2305 浏览 5 评论
870浏览 1评论
758浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
699浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
750浏览 0评论
644浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-2-24 16:45 , Processed in 1.185532 second(s), Total 87, Slave 71 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191