简体   繁体   中英

Random Symbols Appearing in Keil Debug-Watch Window

My project involves sending 4 8-bit data wirelessly between two RF Transceiver modules (one functioning as a primary transmitter, and the other functioning as a receiver). Using Keil uVision5's debugger on the receiver's endpoint (in the Watch Window where I observe certain variables), I noticed that the data received on the other end of the module is correct but symbols appear at the end of some (not all) of the variable's values.

The data is sent in the form of a struct below:

typedef struct
{
   uint8_t Cmd;         // Command/Operation
   uint8_t DataLen;     // Length of Data
   uint8_t* DataBuff;   // 2 Bytes of data
} RFFrame_t;

static RFFrame_t _xTxFrame;    // variable that will hold the data to be transmitted

For some context, the 'Command/Operation' is:

#define SHUTTEROFF_CMD    ((uint8_t)0xDD)
...
_xTxFrame.Cmd = SHUTTEROFF_CMD;

The 'Length of Data' is:

#define TX_BUFFER_SIZE     2
uint8_t TxLength = TX_BUFFER_SIZE;
...
_xTxFrame.DataLen = TxLength;

The 'Data Buffer' is:

uint8_t aTransmitBuffer[TX_BUFFER_SIZE] = {17, 233};
...
_xTxFrame.DataBuff = aTransmitBuffer;

And here is a screenshot of what I am seeing:

观察窗口

In the screenshot above, _xRxFrame.Cmd is in hex display, while _xRxFrame.DataLen, _xRxFrame.DataBuff[0], and _xRxFrame.DataBuff 1 is not in hexadecimal display.

The symbol 'Y' and 'e' appeared at the back of 0xDD and 233 respectively, which actually is not an error for the code as everything works fine. I am just curious as to why this is happening. Is it normal for these symbols to randomly appear in the debug window?

Thank you!

The value's read are 233 and 0xDD; and they are declared as uchar. If you check an ascii table it will match those charecters

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM