2014年1月27日 星期一

STM8S-Discovery_STM8S003F3-8_STM8S陣列宣告記憶體類型

    8051可以宣告指定記憶體類型,例如code、data、idata、bdata、xdata、pdata等類型,那ST STM8S陣列宣告的方式如下列所示:

1. 由設定的參數指定陣列資料在記憶體存放的位置.
@tiny: designates a memory space for which a one byte address is needed.
@near: designates a memory space for which a two byte address is needed.

範例:
@tiny u8 Array1[1] = {0};
@near u16 Array2[1] = {0x00};


2. 由編譯器決定陣列資料在記憶體存放的位置.
const: The const modifier means that the object to which it is applied is constant.
範例:
const char Array3[1] = {0x00};

沒有留言:

張貼留言