谁敢说“精通PIC单片机”的朋友请进,这个问题我就不信只有我一个人遇到?????

2020-02-09 09:31发布

大家好!我在用PICC编绎器的时候遇到一个问题!就是自动变量只能存放在bank0中,而存放在bank1~3中在编绎时就会出错。而bank1~3只能存放静态变量。我的程序很简单。以下图1为PICC编绎的错误提示,而图2是MPLAB中带自的C编绎中的提示,虽然没有提示,但是就出现在一个警告。
#include <pic.h>
void main(void)
{
        bank1 char i;//为什么这里编绎会出错,但是改为“char i;”就没有错了。
    i=12;
    while(1);
}


图1 (原文件名:错误提示.JPG)


图2 (原文件名:MPLAB自带C编绎器中也会警告.JPG)


更可笑的是,我在
http://www.ourdev.cn/bbs/bbs_content.jsp?bbs_sn=4373781&bbs_page_no=1&search_mode=3&search_text=lgh050706&bbs_id=9999

http://pic16.com/bbs/dispbbs.asp?boardid=24&Id=54463

发了一个帖子,竟然没有人有正面的回答,只不是表明这个问题只有我遇到,而大家就从来没有遇到啊!
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
30条回答
bigZ
2020-02-09 16:37
3.3.10.3 Bank0, Bank1, Bank2 and Bank3 Type Quali&#64257;ers
The bank0, bank1, bank2 and bank3 type quali&#64257;ers are always recognised by HI-TECH C
PRO for the PIC10/12/16 MCU Family so that code may be easily ported from other compilers,
however by default, these quali&#64257;ers have no effect.
If the --ADDRQUAL option is set to request(see Section 2.6.19), the bank0, bank1, bank2
and bank3 quali&#64257;ers become a recommendation to place non-auto variables in RAM bank 0, bank
1, bank2 and bank 3, respectively. If space is not available in these banks, another bank will be used.
If the --ADDRQUAL option is set to require, the bank quali&#64257;ers will always place non-auto
objects in the bank speci&#64257;ed. If no room exists in that bank, an error will be generated.
The following example of bank quali&#64257;er usage will either recommend or force (dependent on
the --ADDRQUAL option settings) the unsigned char to be stored in bank3:
static bank3 unsigned char fred;

一周热门 更多>