This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

F2812 外扩RAM c语法



//F2812 读取XINTF ZONE2 ram程序
#define ram_addr  0x00080000
Uint16 tmp;
Uint16 * rambase;
rambase=(Uint16 *)ram_addr; 
 tmp=*rambase
/////////////////////////////
此句rambase=(Uint16 *)ram_addr;  把ram_addr强制转化成uint16指针 ,rambase指向的地址岂不是0x0000;变成芯片内部存储地址了????
求好汉指点???

  • ram_addr  0x00080000本来是一个整数类型,将它赋值给指针类型变量rambase,需要将其强制类型转换指针类型。也就是说rambase的值就等于ram_addr  0x00080000
    ,只不过是数据类型不一样。所以*rambase指向地址为0x00080000的数据。

  • 你好。

    指针数据类型本身是一个32位的整型,所以不会变成你说的0x0000,仍然会是0x00080000.

    Uint16 *表示该指针所指向的是一个16位的整型数