Microchip
直播中

李华

7年用户 1340经验值
私信 关注
[问答]

超过2K程序存储器

我正在用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)

吴键洪

2018-11-14 14:36:58
你使用汇编程序的方式是什么?”“绝对”还是“可重定位”?你使用哪种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?
 
举报

步雅芸

2018-11-14 14:45:55
你好,我使用MPLAB 8.56。我不明白什么是“绝对”或“可重新定位”:

以上来自于百度翻译


      以下为原文

    Hi I use MPLAB 8.56. I do not understand what is "Absolute", or "Relocatable" :(
举报

吴键洪

2018-11-14 15:01:48
如果你要坚持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!
举报

吴键洪

2018-11-14 15:16:00
哦,一旦你的主程序开始修改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.
 
举报

更多回帖

发帖
×
20
完善资料,
赚取积分