'=================================================================== ' Demonstration program for RF24G as a receiver '=================================================================== Peripheral myR As RF24G @ 31 ' Set the module ID as 31 Dim g_bRxReady As Byte ' Declare the variable for receiving status Sub Main() ' Main program starts here Dim bRx As Byte ' Declare the variable for the received data Debug CLS ' Clear the terminal display myR.SetMode(1) ' Set the mode as receiving mode myR.SetCh(0) ' Set the transmission channel as 0 myR.SetRFID(0) ' Set the ID code as 0 myR.SetRegCode(0) ' Set the Reg code as 0 myR.EnRxReadyEvent() ' Enable the receiving complete notification Event myR.Config() ' Update the setting values '------------------------------------------------------------------- ' Use the DO loop to wait for the last data item to be received '------------------------------------------------------------------- Do '------------------------------------------------------------------- ' Use the DO loop to wait for the receipt of data '------------------------------------------------------------------- Do Loop Until g_bRxReady=1 myR.GetVar(bRx) ' Read the received data value g_bRxReady = 0 ' Clear the transmission status Debug CSRXY(1, 1), %DEC3R bRx ' Display the received values on the terminal display Loop Until bRx=100 Debug CSRXY(1, 2), "Receiving complete" ' Displays that the receipt is completed End Sub Event myR.RxReadyEvent() ' Notification event for receipt complete g_bRxReady = 1 ' Set the receiving status as 1 End Event