找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開(kāi)始

搜索
查看: 5771|回復(fù): 3
收起左側(cè)

keil報(bào)錯(cuò)ERROR L121 (IMPROPER FIXUP)

[復(fù)制鏈接]
ID:307417 發(fā)表于 2018-5-9 18:59 | 顯示全部樓層 |閱讀模式
之前找的一份資料里的程序,想改程序時(shí)卻出現(xiàn)了ERROR L121 (IMPROPER FIXUP)的情況,不知道該怎么解決。不過(guò)資料里確實(shí)有HEX文件,我也稍微了解了一下,可能是keil版本高的原因,我用的是keil5.
1.png
2.png
3.png
回復(fù)

使用道具 舉報(bào)

ID:307417 發(fā)表于 2018-5-9 19:08 | 顯示全部樓層
#include "keyboard.h"
extern bit bdata flag_key;
//按鍵掃描函數(shù) :   
//功能;只掃描一個(gè)按鍵,按鍵為號(hào)小優(yōu)先  
//返回鍵值:
//         1    2    3    10           //10:清零重量,兼去皮功能       
//         4    5    6    11           //11:清除單價(jià)
//         7    8    9    12           //12:顯示數(shù)值偏大調(diào)節(jié)按鍵  
//         14   0    15   13           //14:無(wú)功能(用于擴(kuò)展)15:小數(shù)點(diǎn)   13:顯示數(shù)值偏小調(diào)節(jié)按鍵

unsigned char Getkeyboard(void)
{
    unsigned char number = 0;
    unsigned char i;
        //行輸入低電平
    ROW1=ROW2=ROW3=ROW4=0;
        //如果列輸出不全為高,則說(shuō)明有鍵按下
        if (((COL1!=1)||(COL2!=1)||(COL3!=1)||(COL4!=1))&&flag_key==1)
        {
           //輸入0111
           flag_key=0;
           ROW1=0;
           ROW2=ROW3=ROW4=1;
           for (i=0;i<20;i++);
           if (COL1==0) return 1;           // 7
           else if (COL2==0) return 2;        //         8
           else if (COL3==0) return 3;         //        9
           else if (COL4==0) return 10;         //         10
           //輸入1011
           ROW2=0;
           ROW1=ROW3=ROW4=1;
           for (i=0;i<20;i++);
           if (COL1==0) return 4;          //4
           else if (COL2==0) return 5; //  5
           else if (COL3==0) return 6;        // 6
           else if (COL4==0) return 11;         //        11
           //輸入1101
           ROW3=0;
           ROW1=ROW2=ROW4=1;
           for (i=0;i<20;i++);
           if (COL1==0) return 7;  //1
           else if (COL2==0) return 8;          // 2
           else if (COL3==0) return 9;          //   3
           else if (COL4==0) return 12;          //   12
           //輸入0111
           ROW4=0;
           ROW1=ROW2=ROW3=1;
           for (i=0;i<20;i++);
           if (COL1==0) return 14;
           else if (COL2==0) return 0;
           else if (COL3==0) return 15;
           else if (COL4==0) return 13;
           //沒(méi)有檢測(cè)到列低電平
           return 99;
        }
        else if(COL1==1&&COL2==1&&COL3==1&&COL4==1)
        flag_key=1;
        return 99;
}
回復(fù)

使用道具 舉報(bào)

ID:307417 發(fā)表于 2018-5-10 09:51 | 顯示全部樓層

請(qǐng)問(wèn)一下是哪本書(shū)
回復(fù)

使用道具 舉報(bào)

ID:328014 發(fā)表于 2021-1-10 23:44 | 顯示全部樓層
我今天也遇到了同樣的問(wèn)題,IMPROPER FIXUP,研究了半天終于解決了,原來(lái)這個(gè)問(wèn)題是因?yàn)镵eil4和Keil5不支持bdata的問(wèn)題導(dǎo)致的,所以退回Keil2,新建工程,加入文件,重新編譯就OK了,你這個(gè)上面也有bdata所以也可以用我的辦法來(lái)成功解決的.

參考資料:
The variables ibase and bary are bit-addressable. Therefore, the individual bits of these variables may be directly accessed and modified. Use the sbit keyword to declare new variables that access the bits of bdata variables. For example:

sbit mybit0 = ibase ^ 0;      /* bit 0 of ibase */
sbit mybit15 = ibase ^ 15;    /* bit 15 of ibase */

sbit Ary07 = bary[0] ^ 7;     /* bit 7 of bary[0] */
sbit Ary37 = bary[3] ^ 7;     /* bit 7 of bary[3] */
The above example represents declarations, not assignments to the bits of the ibase and bary bdata variables. The expression following the carat symbol ('^') in the example specifies the position of the bit to access with this declaration. This expression must be a constant value.

The range depends on the type of the base variable included in the declaration. The range is:

0-7 for char and unsigned char, 0-15 for int, unsigned int,
short, and unsigned short, and
0-31 for long and unsigned long.

并沒(méi)有定義bit類型的bdata。因此定義成char。

OFDM_PHY_ext   char     bdata   bLib_RxPlcEnd;
OFDM_PHY_ext   char     bdata  RX_BUSY;
OFDM_PHY_ext   char     bdata  TX_BUSY;
Comm_ext char bdata bCommRxEnd;
Comm_ext char bdata bCommRxstart;
回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表