完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我需要将浮点变量转换成XC8编译器中的字符串,但它看起来不喜欢我这样做。Seavtf(DePaseString,“%.2f”,权重);//其中权重是浮点,这是我得到的错误……0:错误:(1347)在CLA中找不到PSXCT“主文”的0x50字(0x50)。SS“代码”(最大未使用的连续范围0x42)可能有一种方法将编译器设置为不同的模型吗?我有类似的不同的微控制器,这就是解决方案。我已经查看了项目选项,但我看不到有什么帮助。也许有一种不同的方式来解决这一问题,而不会遇到编译器问题。谢谢,RogerI忘了提到我用的是PIC16F1834芯片。
以上来自于百度翻译 以下为原文 I need to convert a float variable to a string in XC8 compiler but it would appear that it doesn't like the way I'm doing it. sprintf(display_string,"%.2f",weight); //where weight is a float This is the error I get... :0: error: (1347) can't find 0x50 words (0x50 withtotal) for psect "maintext" in class "CODE" (largest unused contiguous range 0x42) Maybe there's a way to set the compiler to a different model? I had something similar with a different make of microcontroller and that was the solution there. I've looked at the project options but I can't see anything in there what helps. Perhaps there's a different way to do this that doesn't run into compiler issues? Thanks, Roger I forgot to mention that I'm using a PIC16F18344 chip |
|
相关推荐
10个回答
|
|
在上次添加之前,内存(Flash)使用是什么?或者,你可以设置你的微控制器TopIC16F18345来查看当前需要多少内存。
以上来自于百度翻译 以下为原文 What was the memory (Flash) usage prior the last addition? Alternatively you could set your microcontroller to PIC16F18345 - to see how much memory is currently required. |
|
|
|
|
|
|
|
非常感谢弗朗西斯科,这似乎不那么贪婪的记忆。
以上来自于百度翻译 以下为原文 Many thanks Francesco, that seems to be less greedy on memory. |
|
|
|
Flash的使用显示了35%的程序空间。我尝试了弗朗西斯科的建议使用FtoA(),并编译了它,现在显示了64%个我可以使用的程序。这是一个相当简单的应用程序,有一点数学要添加,所以我怀疑它是否会使用剩余的内存。我开始认为我必须回到老式的整数数学来保持它足够小,并编写我自己的字符串输出例程,就像我们30年前做的那样!
以上来自于百度翻译 以下为原文 The flash usage was showing 35% of Program space used. I just tried Francesco's suggestion to use ftoa() and it compiled and is now showing 64% of Program used which I can probably live with. It's a pretty simple application with a bit of maths to add so I doubt if it will use the remaining memory. I was beginning to think I'd have to go back to old school Integer maths to keep it small enough and write my own string output routines like we used to do 30 years ago! |
|
|
|
Primff()/Simulff()是非常有能力和通用性的-以不小的成本为代价。而且,如果你的程序大小从35%增加到64%,用这个“小加法”,而不是过度的“贪婪”-EVEB ftoA()。
以上来自于百度翻译 以下为原文 printf()/sprintf() are very capable and versatile - at the cost of being not exactly small. And - while not being excessively "greedy" - eveb ftoa() isn't very small if your program size increased from 35 % to 64 % with this "little addition". |
|
|
|
xc8ftoA()实际上是使用StaveFF()而脏的。
以上来自于百度翻译 以下为原文 The XC8 ftoa() is dirty as it actually uses sprintf(). |
|
|
|
在8位PIC中不使用浮点的原因与30年前一样有效。浮点在8位PIC中是大而慢的。并且Prtff()也可以是大的。
以上来自于百度翻译 以下为原文 The Reason for not using floats in an 8 bit PIC is as valid today as it was 30 years ago. Floats are big and slow in an 8 bit PIC. and Printf() can also be big. |
|
|
|
|
|
|
|
以上来自于百度翻译 以下为原文 // quick and dirty ftoa for legacy code char * ftoa(float f, int * status) { static char buf[17]; char * cp = buf; unsigned long l, rem; if(f < 0) { *cp++ = '-'; f = -f; } l = (unsigned long)f; f -= (float)l; rem = (unsigned long)(f * 1e6); sprintf(cp, "%lu.%6.6lu", l, rem); return buf; } |
|
|
|
HTTPS://www. McCHIP.COM/FUMMS/M18363.ASPX如何?
以上来自于百度翻译 以下为原文 How about https://www.microchip.com/forums/m183763.aspx |
|
|
|
只有小组成员才能发言,加入小组>>
5202 浏览 9 评论
2016 浏览 8 评论
1942 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3188 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2243 浏览 5 评论
753浏览 1评论
640浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
545浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
652浏览 0评论
552浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-4 14:39 , Processed in 1.365047 second(s), Total 64, Slave 58 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号