完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,我把我的代码从一个16F1887移植到一个18F46K40,与指针或内存分配似乎有一些不同。该代码是用于编写一个LCD,并这样做-主(){LCDyWrrad(“A”);}空隙LCDAX写(const char * DATAAL字符串){(**数据字符串){//…将数据发送到相关端口;*DATAStiON +++;}在16F上工作良好,并且工作在18F4680上,但对于18F46K40,“while”循环永远不会进入,好像*DATAYSHIPE字符串为NULL。当我运行调试时,DATAXX字符串看起来应该是0x41。(0B0100000 01)如果我将while循环条件强制为true,稍后在LCDScript()函数中有此代码“*DATAXStand & 0B1111000”。调试显示该操作的结果为0b00亿。再一次看来,*DATAY字符串被解释为“0”。有什么想法吗?考虑到
以上来自于百度翻译 以下为原文 Hi, I have ported my code from a 16F18877 to a 18F46K40 and there seems to be some differences with pointers or memory allocation. The code is for writing to an LCD and goes like this - main() { lcd_write("A"); } void lcd_write(const char *data_string) { while(*data_string) { // ... send data to relevant port; *datastring++;} } Works fine on the 16F, and also works on a 18F4680, but for the 18F46K40, the 'while' loop is never entered, as if *data_string is NULL. When I run debug the data_string looks like it should though , 0x41. (0b01000001) If I force the while loop condition to TRUE, later in the lcd_write() function there is this code '*data_string & 0b1111000'. Debug shows the result of that operation to be 0b00000000. And so again it seems that *data_string is being interpreted as '0'. Any ideas? regards Tim |
|
相关推荐
8个回答
|
|
XC8还是C18?46K40可能遭受NVMeRG勘误(检查论坛的解决方案),您也知道上述代码无效,但我想这只是一个例子。
以上来自于百度翻译 以下为原文 XC8 or C18? 46K40 may suffer from the NVMREG errata (check the forum for solutions) You also know that the above code is invalid but I suppose it was only meant to be an example |
|
|
|
所有K40的字符串都有问题,需要在XC8附带的自述文件中提到的勘误设置。
以上来自于百度翻译 以下为原文 All the K40's have problems with constant strings, and need the errata setting mentioned in the README file that comes with XC8. |
|
|
|
太棒了,谢谢你和QHB。更新为XC8 1.42,并添加NVMRG,作为“ProjtProjksProtots & Gt;XC8链接器& GT;附加选项-& Grand;G++NVMReg”的ErrATA选项。我永远无法修复它。是的,代码只是一个示例,但是它在哪里无效?
以上来自于百度翻译 以下为原文 fantastic, can't thank you enough and qhb too. updated to XC8 1.42 and added +NVMREG, as an Errata option under "Project Properties -> XC8 linker -> additional options -> Errata -> +NVMREG" . I never would have been able to fix that. Yes, code was just an example, but where is it invalid? |
|
|
|
YVW在这里,我的意思是单行注释{//…将数据发送到相关端口;*DATAISTION+++;
以上来自于百度翻译 以下为原文 yvw In here, I meant - the single-line comment { // ... send data to relevant port; *datastring++;} |
|
|
|
我懂了。是的,只是为论坛保持简短。谢谢。我注意到数学函数也不能正常工作,除非NVMeRG勘误是固定的。函数如SN()和TANE(),返回“0”。为什么会这样?
以上来自于百度翻译 以下为原文 I see. yes, just kept it brief for the forum. thanks. I noticed that math functions also don't work properly unless the NVMREG erratum is fixed. functions like sin() and tan(), return '0'. Why is that so? |
|
|
|
它们可能使用许多内部查找常数。所有的常数查找失败而不需要修复。
以上来自于百度翻译 以下为原文 They probably use a number of internal lookup constants. All sorts of constant lookups fail without that fix. |
|
|
|
Sn()和TANE()的函数由常系数的多项式函数逼近。甚至π也是一个常数。;)
以上来自于百度翻译 以下为原文 Functions such as sin() and tan() are approximated by polynomial functions with constant coefficients. Even pi is a constant. ;) |
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
5162 浏览 9 评论
2000 浏览 8 评论
1928 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3172 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2226 浏览 5 评论
731浏览 1评论
613浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
503浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
629浏览 0评论
527浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-23 11:58 , Processed in 1.221961 second(s), Total 91, Slave 74 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号