在移植freemodbus程序中,portevent.c中的程序如下:
sta
tic eMBEventType eQueuedEvent;
static BOOL xEventInQueue;
/* ----------------------- Start implementation -----------------------------*/
BOOL
xMBPortEventInit( void )
{
xEventInQueue = FALSE;
return TRUE;
}
BOOL
xMBPortEventPost( eMBEventType eEvent )
{
xEventInQueue = TRUE;
eQueuedEvent = eEvent;
return TRUE;
}
BOOL
xMBPortEventGet( eMBEventType * eEvent )
{
BOOL xEventHappened = 0x00;
xMBPortSerialPutByte(xEventInQueue);
if( xEventInQueue == TRUE)
{
xMBPortSerialPutByte(0X09);
*eEvent = eQueuedEvent;
xEventInQueue = FALSE;
xEventHappened = 0x01;
}
return xEventHappened;
}
通过串口观测,xEventInQueue 为0x16,但是在程序赋值时,xEventInQueue 只是赋值了TRUE或FALSE,也就是1或0,但是为什么xEventInQueue 会是0x16,求大神帮下忙,谢谢