完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我正在用PIC16F86做一个矩阵设计。我使用汇编语言。我的问题是,我想把我的子程序(比如Delay、CulnNoSHIFT、RealthyGEN、iNITSH显示)放在我的代码的底部。当我的主程序变大时,上面的子程序跨越2K限制和卡住。如何克服上述情况。注意:我不能把这个子。例程在第一256的位置,因为我有一个冗长的ISR例程。
以上来自于百度翻译 以下为原文 I'm doing a matrix design using PIC16F886. I use assembly language. My question is I want to place my subroutines like (Delay, Column_shift,Random_Gen, Init_Display) in the bottom of my code.When my main program gets bigger the above subroutines crossing 2K limit & gets stuck. How to overcome the above situation. Note: I cannot put the subroutines on 1st 256 location because I have a lengthy ISR routine. |
|
相关推荐
7个回答
|
|
你使用汇编程序的方式是什么?”“绝对”还是“可重定位”?你使用哪种IDE?MPLAB8,还是MPLABX?你知道PCLASE寄存器是如何工作的吗?
以上来自于百度翻译 以下为原文 What mode are you using the assembler in? "Absolute", or "Relocatable"? Which IDE are you using? MPLAB8, or MPLABX? Do you understand how the PCLATH register works? |
|
|
|
你好,我使用MPLAB 8.56。我不明白什么是“绝对”或“可重新定位”:
以上来自于百度翻译 以下为原文 Hi I use MPLAB 8.56. I do not understand what is "Absolute", or "Relocatable" :( |
|
|
|
如果你要坚持MPLAB8,你至少应该得到“最新的和最伟大的”版本,892.你可以从http://www. McCux.com……下载/下载文件,几乎可以肯定的是,你使用的是“绝对”模式,它已经在1980年中变老了。“帮助”,“主题”,“MPASM汇编程序”。扫描索引“可重新定位对象”,以了解更多。这是说,完全可以在绝对模式下完成一个大项目,但这是你的责任,把代码划分成小于2KB的块,并且确保没有块太大。将代码划分在块之间以最小化需要从一个块跳到另一个块的次数。当您想调用另一个块中的子例程时,需要在调用之前执行页面选择,然后再调用另一个块。“PaSeEL”宏使得这很容易。你可以缩短前两个指令,像这样,但要注意,它仍然不是一个单一的指令,不只是一个BTFSC类型的指令之前!
以上来自于百度翻译 以下为原文 If you're going to stick with MPLAB8, you should at least get the "latest and greatest", version 8.92. You can get it from http://www.microchip.com/...ools/downloads-archive That almost certainly means you are using "Absolute" mode, which was already getting old back in the 1980's. In the IDE, select "Help", "Topics", "MPASM Assembler". Scan the index for "Relocateable objects" to learn more. That said, it is perfectly possible to do a large project in Absolute mode, but it is then YOUR RESPONSIBILITY, to divide your code up into blocks of less than 2KB, and ensure no block gets too big. You need to divide your code between the blocks to minimise how often you need to jump from one block to another one. When you want to call a subroutine in another block, you need to do a page select before the CALL, and another one after it. The "PAGESEL" macro makes this easy. pagesel FAR_SUB ;prepare PCLATH with destination page (takes two instructions) call FAR_SUB ;call to the other page pagesel $ ;restore the page select to us you can shorten the first two instructions like this lcall FAR_SUB ;set PCLATH and call to the other page (this is three instructions) pagesel $ ;restore the page select to us but beware that it is still not a single instruction, do NOT but a BTFSC type instruction before it! |
|
|
|
哦,一旦你的主程序开始修改PCLATE,你必须确保你的中断服务代码(1)在PCLATE中保存值,当服务在执行任何Goto或call指令之前退出[2 ]清除PCLATE时准备恢复。这意味着你不能在LoATAI上放置Goto指令。0004。
以上来自于百度翻译 以下为原文 oh, and as soon as your main program starts modifying PCLATH, you must make sure your interrupt service code [1] Saves the value in PCLATH, ready to restore when the service exits [2] Clear PCLATH before you execute any GOTO or CALL instruction. This means you must NOT put a GOTO instruction at location 0004. |
|
|
|
你好,很好的描述。我试过你的代码。它工作得很好。非常感谢。我怎样才能在2K程序内存之上用不同的页面做GOTO命令?
以上来自于百度翻译 以下为原文 Hi, Excellant description. I tried your code & it worked great. Thank you very much. How can I make a goto command with a different page above 2K program memory? |
|
|
|
这不是我刚才给你看的吗?对不起,我一定误解了这个问题。
以上来自于百度翻译 以下为原文 Isn't that what I just showed you? Sorry, I must be misunderstanding the question. |
|
|
|
现在是阅读PIC数据表的免费手册——2.3“PCL和PCLATE”的时候了,它只有1/4页长。
以上来自于百度翻译 以下为原文 It's time to read the free manual -- §2.3 "PCL and PCLATH" of the PIC datasheet, it's only 1/4 page long. |
|
|
|
只有小组成员才能发言,加入小组>>
5170 浏览 9 评论
2001 浏览 8 评论
1931 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3176 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2228 浏览 5 评论
736浏览 1评论
619浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
507浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
633浏览 0评论
530浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-25 12:19 , Processed in 1.235228 second(s), Total 89, Slave 72 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号