完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我使用PIC18F25K22对一个大的查找表有问题。当查找号码在46号或超过46号时,代码返回“0xFF”。我复制了本论坛上找到的代码。如有任何帮助,我们将不胜感激。
以上来自于百度翻译 以下为原文 I'm having a problem with a large lookup table using the PIC18F25K22. When the lookup is at or beyond the 46th number the code returns "0xFF". I copied code I found on this forum. Any help would be much appreciated. Step3; Temp Conversion movlw .209 ;209 won't work, but 210 will movwf evapL1 movf evapL1,W sublw .255 ; 255-evapL1=W movwf hold1; result in hold1 call Table return ;****************************************************************** org 0x4800 Table movlw UPPER Table1 movwf TBLPTRU movlw HIGH Table1 movwf TBLPTRH movlw LOW Table1 movwf TBLPTRL movf hold1,w addwf TBLPTRL,f clrf WREG addwfc TBLPTRH,f addwfc TBLPTRU,f tblrd * ; Read movff TABLAT,hold1 ; Get character into hold1 return Table1 db .88,.87,.87,.86,.86,.86,.85,.85,.85,.84,.84,.84,.83,.83,.82,.82,.81,.81,.81,.81,.80,.80,.80,.79,.79,.79,.79,.78,.78,.78,.77,.77,.77,.76,.76,.75,.75,.74,.74,.73,.73,.73,.73,.72,.72,0x47,0x48,0x47,0x46,0x44,0x44,.67,.67,.66,.66,.65,.65,.64,.64,.63,.63,.63,.62,.62,.61,.61,.60,.60,.59,.59,.58,.57,.56,.56,.55,.55,.54,.54,.53,.53,.53,.52,.52,.51,.51,.50,.50,.49,.49,.48,.48,.47,.46,.45,.44,.43,.42,.41,.40,.40,.39,.39,.38,.37,.35,.32,.31,.30,.28,.26,.24,.22,.22,.20,.20,.19,.19 end |
|
相关推荐
19个回答
|
|
|
|
|
|
它用于获取查找表的索引。EVAPL1是A/D值<255。
以上来自于百度翻译 以下为原文 It used to get an index for the look up table. evapL1 is an A/D value < 255 |
|
|
|
程序集代码行的最大长度为255个字符。
以上来自于百度翻译 以下为原文 The maximum length of an assembly code line is 255 characters. |
|
|
|
|
|
|
|
你知道Microchip的软件,它很擅长沉默处理。;)
以上来自于百度翻译 以下为原文 You know Microchip software well -- it's good at silent treatment. ;) |
|
|
|
但我记得有时候,它确实咬了别人
以上来自于百度翻译 以下为原文 But I remember that somehow this did bite someone else, time ago |
|
|
|
但是如果您不包含这个DB指令,则有117个字符。或者,
以上来自于百度翻译 以下为原文 But this db directive has 117 characters if you don't include the . or , |
|
|
|
为什么人们会这么难?什么部分的“最大长度的A…“你有困惑吗?”
以上来自于百度翻译 以下为原文 Why do people make this so difficult? What part of the "maximum length of a ... line" do you have confusion? |
|
|
|
_当然_你确实包括65290;等等。公平地说,我接触PIC时做的第一件事就是将默认基数设为10并避免愚蠢_
以上来自于百度翻译 以下为原文 *of course* you do include "." etc. To be fair, first thing I did as I got in touch with PICs was to set the Default Base to 10 and avoid that stupid "." ... |
|
|
|
是什么让你认为你可以排除“或”?
以上来自于百度翻译 以下为原文 What makes you think you can exclude the "." or "," ? |
|
|
|
实际上,默认基数将使用更少的字符。LOL:格林先生:LOL:
以上来自于百度翻译 以下为原文 Actually the default radix would use less characters. LoL: mr green: LoL: |
|
|
|
|
|
|
|
对于基数10,小数255取3个字符,但是如果使用默认的十六进制基数,则只需要2个字符。同样,15比F等格林先生:
以上来自于百度翻译 以下为原文 For base 10 the decimal number 255 takes 3 characters, but it takes only 2 characters if we use the default radix of hex. Similarly, 15 vs F, etc. mr green: |
|
|
|
好啊!是的,如果一切都是十六进制和没有前缀……我在考虑小数。
以上来自于百度翻译 以下为原文 ahhh ok! Yep, if everything is written as hex and without prefix... I was considering decimal |
|
|
|
最快速的解决方案是只更改,只要确保每行都有偶数个值以避免对齐问题。
以上来自于百度翻译 以下为原文 Quickest solution is to just change db .88,.87,.87,.86,.86,.86,.85,.85,.85,.84,.84,.84,.83,.83,.82,.82,.81,.81,.81,.81,.80,.80,.80,.79,.79,.79,.79,.78,.78,.78,.77,.77,.77,.76,.76,.75,.75,.74,.74,.73,.73,.73,.73,.72,.72,0x47,0x48,0x47,0x46,0x44,0x44,.67,.67,.66,.66,.65,.65,.64,.64,.63,.63,.63,.62,.62,.61,.61,.60,.60,.59,.59,.58,.57,.56,.56,.55,.55,.54,.54,.53,.53,.53,.52,.52,.51,.51,.50,.50,.49,.49,.48,.48,.47,.46,.45,.44,.43,.42,.41,.40,.40,.39,.39,.38,.37,.35,.32,.31,.30,.28,.26,.24,.22,.22,.20,.20,.19,.19 to db .88,.87,.87,.86,.86,.86,.85,.85,.85,.84,.84,.84,.83,.83,.82,.82 db .81,.81,.81,.81,.80,.80,.80,.79,.79,.79,.79,.78,.78,.78,.77,.77 db .77,.76,.76,.75,.75,.74,.74,.73,.73,.73,.73,.72,.72,0x47,0x48,0x47 db 0x46,0x44,0x44,.67,.67,.66,.66,.65,.65,.64,.64,.63,.63,.63,.62,.62 db .61,.61,.60,.60,.59,.59,.58,.57,.56,.56,.55,.55,.54,.54,.53,.53 db .53,.52,.52,.51,.51,.50,.50,.49,.49,.48,.48,.47,.46,.45,.44,.43 db .42,.41,.40,.40,.39,.39,.38,.37,.35,.32,.31,.30,.28,.26,.24,.22 db .22,.20,.20,.19,.19 Just make sure each line has an even number of values to avoid alignment problems. |
|
|
|
好的,我明白了。由于您的智慧“1和0”,我把这个大表分解为3个,比如:db.80、.79、.78、.77、、、、、、、、、、、、、、、72db.72、.71、、、、、、、、、、、、、、、、、、、、、、、、、、、68db.68、.68、.67………………60索引或偏移量可能导致结果滚到下一个db。我正在使用RADIX十六进制。谢谢!
以上来自于百度翻译 以下为原文 Ok, I've got it. Thanks to your wisdom "1and0". I broke up the large table into 3 such as this : db .80,.79,.78,.77,,,,,,,,,.72 db .72,.72,.71,,,,,,,,.68 db .68, .68,.67........60 and the index or offset may cause the result to roll over to the next db. and i'm using RADIX hex. Thanks All ! |
|
|
|
谢谢你,我一定一直在读你的想法。我会确保每一行都有一个偶数。
以上来自于百度翻译 以下为原文 Thanks ghb, i must have been reading your mind. I'll make sure each line has an even number. |
|
|
|
正如Cinzia所说,将基数设置为十进制,您不必对十进制数字使用愚蠢的点前缀。此外,由于表只有117个条目,因此可以考虑检查索引范围。
以上来自于百度翻译 以下为原文 As Cinzia said, set the radix to decimal radix dec and you will not have to use the stupid dot prefix for decimal numbers. Also, you might consider checking the index range since your table has only 117 entries. |
|
|
|
我的代码中有许多其他地方(>10k行)使用点作为十进制,如果使用RADIX=dec,我不想回去更改它们。实际上我最终得到了6行db的Index范围为0到117,正如我提到的,A/D值是137到255(118)
以上来自于百度翻译 以下为原文 I have many other places in my code (>10k lines) that use the dots for decimal and I don't want to go back and change them if I use RADIX =dec. The dot works fine in the db as long as each line is not>256. Actually I ended up with 6 lines of db's Index range is 0 to 117 , as I mention, and the A/D values are 137 to 255 (118) |
|
|
|
只有小组成员才能发言,加入小组>>
5184 浏览 9 评论
2005 浏览 8 评论
1932 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3179 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2230 浏览 5 评论
742浏览 1评论
628浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
512浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
640浏览 0评论
538浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-28 21:55 , Processed in 1.613681 second(s), Total 114, Slave 98 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号