#include <m8c.h> // part specific constants and macros #include "PSoCAPI.h" // PSoC API definitions for all User Modules #include "RX8.h"
BOOL fWaitToReceiveByte(void) { BYTE bRxStatus;
/* Wait to receive full byte*/ while ( !( bRxStatus=RX8_bReadRxStatus() & RX8_RX_COMPLETE ) ) { /* might want to sleep or keep track of time */ }
/* data received, now check for errors */ if (( bRxStatus & RX8_RX_NO_ERROR ) == 0 ) { /* no error detected */ bRxData = RX8_bReadRxData(); return( TRUE ); } else { /* error detected */ bRxData = bRxStatus; return( FALSE ); } }
void main(void) { |