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.
您好!
是否可以在 CCS 中定义8位整数? 声明 uint16_t 和 uint32_t 有效、但 uint8_t 抛出错误"error #20:identifier "uint8_t" is undefined"。 下面是我要使用的代码:
#include "time.h" #include "stdio.h" #include "device.h" #include "stdint.h" int send_spi_singlebyte(uint8_t code11, uint16_t code12, uint16_t temp, int noSPIresponse, int loopcounter) {//113 018 if (loopcounter >0){ return 0; } else{ SPI_writeDataBlockingFIFO(mySPI0_BASE, code11); SPI_writeDataBlockingFIFO(mySPI0_BASE, code12); SPI_writeDataBlockingFIFO(mySPI0_BASE, temp); int counter2 = 0; return noSPIresponse++; } }
我看到在_stdint.h 和_types.h 中不包括 uint8_t。 这是因为 MCU 是16位吗?
C2000ware 版本4.01
此致、
MZivcec
MZivcec、
C28x 编译器不提供 uint8_t 类型 对于 C28x、 uint8_t 和 char 是16位数字。
请参阅文章 Byte Accesses with the C28x CPU 是否 有用。
此致
Siddharth
您好、Siddarth、
感谢您提供该文章的链接。 我尝试使用_byte、SPI 传输的行为与之前使用 uint16_t 时相同、当 SPI 为8位宽时、MOSI 上不显示任何数据。 尽管我找到了权变措施:
这会通过 SPI 以二进 制方式传输初始值"11"、因为当设置为8位 SPI 长度时、F280025C 会切断整数的8个最低有效位。
即,二进制中的11为'00001011',二进制中的11*256为'00001011 000000000000'。 由于电路板忽略第二个字节、 因此只发送00001011。 希望这有助于寻找解决方案的其他人。
此致、
Michael