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:在 CCS 版本:7.2.0.00013中写入十六进制值的正确方法

Guru**** 2581345 points


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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/612397/ccs-correct-way-of-writing-a-hex-value-in-ccs-version-7-2-0-00013

工具/软件:Code Composer Studio

我使用的是 MSP432R (红色) Launchpad、并具有以下代码片段

volatile unsigned int rxbuff 计数= 0;

volatile int8_t rxbuff[256];  // 256字节缓冲区

空 EUSCIA2_IRQHandler (空)

// uint8_t rxchar;
uint32_t status = MAP_UART_getEnabledInterruptStatus (EUSCI_A2_base);
MAP_UART_clearInterruptFlag (EUSCI_A2_base、status);

IF (STATUS 和 EUSCI_A_UART_receive_interrupt_FLAG)

rxbuff [rxbuff 计数]= map_UART_receiveData (eUSCI_A2_base);
MAP_UART_transmitData (eUSCI_A2_base、rxbuff [rxbuff 计数]);

if ((rxbuff [rxbuff 计数])==-52)

Buffer_Full = 1;

rxbuff 计数++;

三、工作安排

当 UART 读取十六进制值 CC 时、if 语句(if ((rxbuff [rxbuff _count])==-52)              按预期计算 true。

但是,如果我将其重写为: if ((rxbuff [rxbuff 计数])=0xcc)  或即使 (rxbuff [rxbuff 计数]=0xCC)

它始终被跳过。

在 CCS 中表示十六进制值的正确方法是什么?

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

    尊敬的 David:

     尝试将 rxbuff 定义为 uint8_t、并告知我们它是否起作用。

    volatile uint8_t rxbuffer[256];// 256字节缓冲区 

    此致、

     David

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

    您好,大卫杜夫

    谢谢。 这解决了问题(即从..int_8'更改了)。 至'unint_8')。 代码现在按预期工作。