TI中文支持网
TI专业的中文技术问题搜集分享网站

TMS320F28335 字符串存储问题

在调试中发现,字符串默认存储是一个英文字符需要2个字节,第一个字节为0,第二个字节才是对应的ASCII码。但是我需要存储大量的字符串,有没有办法充分利用存储空间?

Eric Ma:

F28X默认最小寻址是16位。如果要访问8位的数据,可以参考文档TMS320C28x C/C++ Language Implementation User's Guide (SPRU514) in Section 6.3 called Data Types.

There are compiler instrinsics __byte() and __mov_byte() to access data in increments of 8-bits。

int  __byte( int *array, unsigned int byte_index );

   int a;

   int b1;

   int c;

 

   a = 0x1234;

   b1 = __byte(&a,0);  // b = 0x0034

   c = __byte(&a,1);  // c = 0x0012

 

   __byte(&a,0) = 0x55;  // a = 0x1255

   __byte(&a,1) = 0x77;  // a = 0x7755

Eric

赞(0)
未经允许不得转载:TI中文支持网 » TMS320F28335 字符串存储问题
分享到: 更多 (0)