完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
在我的一个项目中有一些表,当我使用这个Tab蕾时,在WrreReGiStEnter()中看到错误的数据;函数。当我添加一些虚拟数据(从来没有使用过)时,它是正确的。在模拟器中,当我跟踪时,错误的数字
以上来自于百度翻译 以下为原文 In one of the my project there is some table const u8 const RegistersCfg[] = {10, 20, 50}; and when I use this table WriteRegister(i, RegistersCfg); I see wrong data inside the WriteRegister(); function. It is works correct when I add some dummy data (that never used) before const char const Data[] = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" "CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC" "DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD"; The difference in listing are Correct code ... 6 psect mediumconst,global,reloc=2,class=MEDIUMCONST,delta=1,noexec ... 2050 ;sx1212driver.c: 109: if (i < 0x14) WriteRegister(i, RegistersCfg); 2051 000766 0E14 movlw 20 2052 000768 600A cpfslt InitRFChip@i,c 2053 00076A D00D goto l2128 2054 00076C 0EDF movlw low _RegistersCfg 2055 00076E 240A addwf InitRFChip@i,w,c 2056 000770 6EF6 movwf tblptrl,c 2057 000772 6AF7 clrf tblptrh,c 2058 000774 0E3F movlw high _RegistersCfg 2059 000776 22F7 addwfc tblptrh,f,c 2060 000778 if 0 ;There are less than 3 active tblptr bytes 2061 000778 endif 2062 000778 0008 tblrd * 2063 00077A CFF5 F004 movff tablat,WriteRegister@value 2064 00077E 500A movf InitRFChip@i,w,c 2065 000780 EC65 F004 call _WriteRegister 2066 000784 D00C goto l2130 2067 000786 l2128: Wrong code ... 6 psect smallconst,global,reloc=2,class=SMALLCONST,delta=1,noexec ... 2097 ;sx1212driver.c: 109: if (i < 0x14) WriteRegister(i, RegistersCfg); 2098 000BBC 0E14 movlw 20 2099 000BBE 600A cpfslt InitRFChip@i,c 2100 000BC0 D00D goto l2126 2101 000BC2 500A movf InitRFChip@i,w,c 2102 000BC4 0F01 addlw low _RegistersCfg 2103 000BC6 6E08 movwf ??_InitRFChip& (0+255),c 2104 000BC8 C008 FFF6 movff ??_InitRFChip,tblptrl 2111 000BCC 0008 tblrd * 2112 000BCE FFFF dw 65535 ; errata NOP 2113 000BD0 CFF5 F004 movff tablat,WriteRegister@value 2114 000BD4 500A movf InitRFChip@i,w,c 2115 000BD6 ECB7 F006 call _WriteRegister 2116 000BDA D00D goto l2128 2117 000BDC l2126: 2118 000BDC FFFF dw 65535 ; assembler added errata NOP All errata, that I try to apply are not helps I see even in the simulator wrong numbers when I trace the WriteRegister(i, RegistersCfg); |
|
相关推荐
5个回答
|
|
这将是一个很好的想法来展示你正在使用的PIC设备。它是K40吗?
以上来自于百度翻译 以下为原文 It would have been a really good idea to reveal what PIC device you are working with. Is it a K40? |
|
|
|
|
|
|
|
在过去的两个月里,关于XC8和K40芯片的问题有多个主题。请参阅:http://www. McCys/Foals/M96972.ASPXHTTP://www. McCHIP.COM/FUMMS/M957 860.ASPXhttp://www. McCHIP.COM/FUMMS/M96517ASPXand更多。最后一行,获得XC8的最新版本,并添加规范。已更改的勘误表切换到它。
以上来自于百度翻译 以下为原文 There have been multiple topics about problems with XC8 and K40 chips in the last two months. See: http://www.microchip.com/forums/m967972.aspx http://www.microchip.com/forums/m957860.aspx http://www.microchip.com/forums/m965517.aspx and more. Bottom line, get the latest version of XC8, and add the specified errata switch to it. |
|
|
|
它看起来不像K40问题(NVMCON1=0x80;//硅勘误表3.1)。它看起来像是常见的编译器问题。如果我在代码中添加了我的代码(在模拟器中,但是在硬件上是一样的,正如我所看到的),我看到它是正确的。
以上来自于百度翻译 以下为原文 It isn't looks like K40 problem (with NVMCON1 = 0x80; //Silicon Errata 3.1). Its looks like common compiler problem. I see that it works correct if I add follow line to the my code (in the simulator, but in hardware it is the same, as I can see). TBLPTR = &RegistersCfg[0]; if (i < REG_RSSIVALUE) WriteRegister(i, RegistersCfg); PS So now listing is follow 2099 ;sx1212driver.c: 107: { 2100 ;sx1212driver.c: 108: NVMCON1 = 0x80; 2101 000BAA 0E80 movlw 128 2102 000BAC 6E81 movwf 3969,c ;volatile 2103 2104 ;sx1212driver.c: 109: TBLPTR = &RegistersCfg[0]; 2105 000BAE 0E01 movlw low _RegistersCfg 2106 000BB0 6EF6 movwf tblptrl,c ;volatile 2107 000BB2 0E04 movlw high _RegistersCfg 2108 000BB4 6EF7 movwf tblptrh,c ;volatile 2109 000BB6 0E00 movlw low (_RegistersCfg shr (0+16)) 2110 000BB8 6EF8 movwf tblptru,c ;volatile 2111 2112 ;sx1212driver.c: 110: if (i < 0x14) WriteRegister(i, RegistersCfg); 2113 000BBA 0E14 movlw 20 2114 000BBC 600B cpfslt InitRFChip@i,c 2115 000BBE D00C goto l2190 2116 000BC0 500B movf InitRFChip@i,w,c 2117 000BC2 0F01 addlw low _RegistersCfg 2118 000BC4 6E09 movwf ??_InitRFChip& (0+255),c 2119 000BC6 C009 FFF6 movff ??_InitRFChip,tblptrl 2120 000BCA if 0 ;There is only one active tblptr byte 2121 000BCA endif 2122 000BCA if 0 ;tblptru may be non-zero 2123 000BCA endif 2124 000BCA if 0 ;tblptru may be non-zero 2125 000BCA endif 2126 000BCA 0008 tblrd * 2127 000BCC CFF5 F005 movff tablat,WriteRegister@value 2128 000BD0 500B movf InitRFChip@i,w,c 2129 000BD2 EC5A F006 call _WriteRegister 2130 000BD6 D00B goto l2192 2131 000BD8 l2190: |
|
|
|
解决了的!在程序开始时,DeByID/RevsID访问是破坏TBLPTR寄存器初始值的问题。我添加代码保存它,现在所有的工作都是正确的。
以上来自于百度翻译 以下为原文 Solved! It was problem with DEV_ID/REV_ID access in the beginning of the program that destroy the initial value of the TBLPTR register. I add code for save it and now all works correct. |
|
|
|
只有小组成员才能发言,加入小组>>
5161 浏览 9 评论
1999 浏览 8 评论
1928 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3171 浏览 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 00:15 , Processed in 1.423519 second(s), Total 86, Slave 69 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号