完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
您好每一个设备是PIC18F46K22,40引脚DIP封装,我使用XC8编译器。我想知道在RAM数据空间的差异,如果我在自由模式与Pro(试用)模式编译。例如,如果在自由模式中使用的RAM空间是99%,它会减少,如果我去PRO试用版?任何帮助都是伟大的。
以上来自于百度翻译 以下为原文 Hello everyone My device is PIC18F46K22, 40 Pins DIP Package and i am using XC8 compiler. I wanted to know the difference in RAM data space used if i compile in Free mode VS Pro (trial) mode. For example if RAM space used in Free mode is 99% will it reduce if I go for Pro Trial version? Any help is great. |
|
相关推荐
9个回答
|
|
这意味着你的代码可能是好的。作为经验法则,优化在坏的斜率代码上工作得很好,但是它们不能对代码进行大量的补充。当然也有例外。
以上来自于百度翻译 以下为原文 This means you code is probably good. As a rule of thumb, optimizations work very well on bad sloppy code, but they cannot add much to the code which is already good. There are exceptions, of course ... |
|
|
|
如果选择适当的系数,就不需要浮点。例如,几乎相同,但1/1024有利于整数的使用,与0.0.1相比,这会产生可怕的舍入,因此最好先将FY值存储乘以1024,这在简化之后产生toor,这是可以进一步简化或替换的。这是非常容易计算的分区,当你需要得到你的FY值,你也可以添加适当的舍入到您的班次。
以上来自于百度翻译 以下为原文 You do not need floating point if you choose appropriate coefficients. For example: F_value=var_read*0.001+F_value*0.999; is nearly identical to F_value = (var_read/1024) + (F_value*1023/1024); but 1/1024 facilitates the use of integers compared to 0.001. However, this produces horrible rounding, so it is better to store F_value pre-multiplied by 1024, which yields to F1024_value = (var_read/1024 + (F_value*1023/1024))*1024; or after some simplification F1024_value = var_read + (F_value*1023); which is the same as F1024_value = var_read + (F1024_value*1023/1024); Which can be further simplified to F1024_value += var_read - F1024_value/1024) Or, replacing the division by shift F1024_value += var_read - (F1024_value >> 10); This is extremely easy to calculate, and when you need to get your F_value, you do F_value = F1024_value >> 10; You can also add proper rounding to your shifts. |
|
|
|
这很有意思。你能告诉我数据类型是不是可以把一些预乘的结果保存在查找表中进行快速计算?
以上来自于百度翻译 以下为原文 That's very interesting once again. Can you kindly tell me the data types for F_value; F1024_value; var_read; Is it possible to save some pre-multiplied results in a lookup table for fast calculations? |
|
|
|
我猜想,所有这些变量都是未签名的16位整数。编辑:我错了,见下文。
以上来自于百度翻译 以下为原文 edit: and I'd be wrong, see below. |
|
|
|
FY-Valk和ValuRead必须能够保持ADC值。如果你的ADC是10位,那么16位整数就可以了。F1024Y值必须是10位宽,10位+ 10位=20位,所以32位整数就可以了。你所做的就是:不需要任何乘法。
以上来自于百度翻译 以下为原文 F_value and var_read must be able to hold the ADC value. If your ADC is 10-bit then 16-bit integers will do. F1024_value must be 10 bits wide, 10-bit + 10-bit = 20-bit, so 32-bit integers will be Ok. All you do is this: F1024_value += var_read - (F1024_value >> 10); There's no need for any multiplications. |
|
|
|
你能解释一下转变价值是什么意思吗?我必须说,这是一个非常漂亮和深思熟虑的数学编码方法。我正在读上面的帖子中提到的DSP指南手册,但是我在这里找不到这种简化的编码。这是你自己设计的威廉希尔官方网站
还是来自某本书?谢谢分享。
以上来自于百度翻译 以下为原文 Can you please explain what it means to round a shifted value? I must say this is something very beautiful and deeply thought out way of coding the maths. I am going through the dspguide book that is mentioned in a post above but this level of simplified coding i cannot even find there. Is it your own devised technique or is it from some book? Thanks for sharing it. |
|
|
|
当你做浮点除法时,你得到分数:整数除法(或移位仿真器)只是砍掉分数:但是1.75比2接近2,所以最好是舍入而不是斩波。要做到这一点,你需要在操作之前把除数的一半加到股利上:在你的情况下:不。我真的记不起我什么时候开始使用这些东西了。那是很久以前的事了。
以上来自于百度翻译 以下为原文 When you do floating point division, you get fractions: 7.0/4 = 1.75 Integer division (or shift emulating it) just chops the fraction off: 7/4 = 7 >> 2 = 1 But 1.75 is close to 2 than to 1, so it is better to have rounding instead of chopping. To do this, you need to add half of the divisor to the dividend prior to the operation: (7+2)/4 = (7+2) >> 2 = 2 In your case: F1024_value += var_read - ((F1024_value + 512) >> 10); No. Not from a book. I really cannot remember when I started using these. It was a long time ago. |
|
|
|
准确度只取决于计算的算法是多么干净。使用AN575的引用,它有一个非常好的(古)算法。从该文中,求和使用248个周期,乘以574。所以总共是1396个周期,加上调用和数据的移动,所以大约1500个循环最大值。这对代码来说是可以接受的吗?编辑:我同意,使用整数移位的实现要好得多,更干净和更快,如果你接受平滑的因素限制为2 ^ NSO,我不知道这对PIC会不会很困难,我真的无法理解你的意思是什么…关于滤波器比较,我确信DSP书在过滤器之间有许多比较。而且总是有Excel,这是一块蛋糕来模拟所有这些东西。
以上来自于百度翻译 以下为原文 Accuracy depends only on how clean the algorithm that does the calculation is. Use the reference from AN575, it has a very good (ancient) algorithm. From that paper, sum uses 248 cycles, multiply uses 574. So total would be 1396 cycles, plus call and movements of data, so around 1500 cycles max. Is this acceptable for your code? Edit: and I agree, the implementation using the shifts in integers is much better, cleaner and faster, if you accept the restriction of factors for the smoothing as being 2^n So I don't know if it will be hard for the PIC, indeed I could not understand what you meant with hard ... About filter comparison, I'm sure the DSP book has many comparisons between the filters. And there is always excel, were it is a piece of cake to simulate all this stuff. |
|
|
|
好威廉希尔官方网站
,我总是检查携带
以上来自于百度翻译 以下为原文 Nice technique, I was always checking carry ... RRF myVar, f BTFSC STATUS, C INCF myVar, f ... |
|
|
|
只有小组成员才能发言,加入小组>>
5323 浏览 9 评论
2076 浏览 8 评论
1982 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3254 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2293 浏览 5 评论
835浏览 1评论
732浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
674浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
728浏览 0评论
622浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-2-3 14:35 , Processed in 1.270106 second(s), Total 92, Slave 76 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号