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.

[参考译文] LAUNCHXL-F280025C:"错误#20:identifier "uint8_t"未定义"

Guru**** 2036780 points
Other Parts Discussed in Thread: C2000WARE
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1131156/launchxl-f280025c-error-20-identifier-uint8_t-is-undefined

器件型号:LAUNCHXL-F280025C
主题中讨论的其他器件:C2000WARE

您好!

是否可以在 CCS 中定义8位整数? 声明 uint16_t 和 uint32_t 有效、但 uint8_t 抛出错误"error #20:identifier "uint8_t" is undefined"。 下面是我要使用的代码:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#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++;
}
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

我看到在_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 上不显示任何数据。 尽管我找到了权变措施:

    1. 将 SPI 设置为8位宽
    2. 将16位整数乘以256 (例如,如果要发送值'11',11*256=2816)
    3. 通过 SPI 发送该整数

    这会通过 SPI 以二进 制方式传输初始值"11"、因为当设置为8位 SPI 长度时、F280025C 会切断整数的8个最低有效位。

    即,二进制中的11为'00001011',二进制中的11*256为'00001011 000000000000'。 由于电路板忽略第二个字节、  因此只发送00001011。 希望这有助于寻找解决方案的其他人。

    此致、

    Michael