在IAR C语言编译环境中,发现MSP430FG4619的FLASH的读写方法已不能象F449那样读写了,对于低于0XFFFF的地址空间的操作两者是一样的,但想对超过0XFFFF的FLASH空间该如何操作呢?如果象F449以前那样的读写程序直接把地址变量定义为32BIT的变量是行不通,如何用C语言来完成这个功能,IAR编译器里有这么一个功能。
在IAR的HELP文件中有如下几个函数说明:
1) __data20_write_type
Syntax
void __data20_write_type(unsigned long address, unsigned type);
where:
address Specifies the address for the write operation
type Can be one of the types char, short, or long
Description
Writes a value to the given 20-bit address. This intrinsic function is only useful on devices based on the MSP430X architecture and must be used when writing data that is located above the first 64 Kbytes of memory. The following functions are supported:
Function Operation size Alignment
unsigned char __data20_write_char 8 1
unsigned short __data20_write_short 16 2
unsigned long __data20_write_long 2*16 2
2)__data20_read_type
Syntax
unsigned type __data20_read_type(unsigned long address);
where:
address Specifies the address for the read operation
type Can be one of the types char, short, or long
Description
Reads data from the given 20-bit address. This intrinsic function is only useful on devices based on the MSP430X architecture and must be used when reading data that is located above the first 64 Kbytes of memory. The following functions are supported:
Function Operation size Alignment
unsigned char __data20_read_char 8 1
unsigned short __data20_read_short 16 2
unsigned long __data20_read_long 2*16 2
在需要写超过0XFFFF地址的FLASH空间时,用__data20_write_type或__data20_read_type 直接代替原有程序中的读写操作即可,但用于小于0XFFFF地址空间的操作将会出错。
文章评论(0条评论)
登录后参与讨论