為什么我串口傳輸的數據在電腦打印輸出不是'S',但是如果我使用#define定義KS 為'S'時就能正常打印輸出‘S’?這兩者有什么區別嗎?
單片機代碼如下:
void main(void)
{
// initialize the device
SYSTEM_Initialize();
// When using interrupts, you need to set the Global and Peripheral Interrupt Enable bits
// Use the following macros to:
// Enable the Global Interrupts
//INTERRUPT_GlobalInterruptEnable();
// Enable the Peripheral Interrupts
//INTERRUPT_PeripheralInterruptEnable();
// Disable the Global Interrupts
//INTERRUPT_GlobalInterruptDisable();
// Disable the Peripheral Interrupts
//INTERRUPT_PeripheralInterruptDisable();
char KS;
KS= 'S';
while (1)
{
// Add your application code
putch(KS);
}
}
|