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.

[参考译文] MSP430FR2355:mssg 中未出现 unsigned char??

Guru**** 2538930 points


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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/964351/msp430fr2355-unsigned-char-not-appearing-within-mssg

器件型号:MSP430FR2355

我有以下代码行:

strncat (strncat (strcpy (Send、"JA")、sysID、4)、(const char *)传感器、 1);

我正在尝试将一个无符号字符(传感器)连接到上面的消息。  传感器在进入消息时看起来是正确的、但一旦连接、它将变为另一个值。  如果我更换、我会发现这一点  

(const char*)带有"0" 的传感器上面的操作...我确定这与字符串和字符有关,但我不确定如何解决它?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    "sensor"的声明缺失。 大概是指字符的指针以外的东西、或者您不需要转换。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    字符传感器; 

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您需要的是 sensor、而不是 cast (&S)。 强制转换获取传感器的值、并将其作为地址进行预处理。