English
Language : 

SDBC-DK3UG Datasheet, PDF (49/76 Pages) Silicon Laboratories – 4 buttons and 4 LEDs for custom purposes
SDBC-DK3 UG
The foreground loop continuously polls the nIRQ pin of the receiver. If the
nIRQ is active (low), the microcontroller starts a status read. Then reads
out the data packets from the FIFO.
while (1)
// stay in receiving mode
{
switch ( RFPacketReceived(&packet[0],&length) )
// check the status packet reception
{
case RF_NO_PACKET:
// CHIP is in RX mode, but no preamble detected
yet
If Button#1 is pressed, the LED1 will blink, and both the synthesizer and
the power amplifier (PA) will be turned on. Then the packet will be built, and
transmitted via the FIFO. Once complete, the power amplifier will be turned
off and the system will return to receive mode.
if ( PB1_PIN == 0 )
{
while(PB1_PIN == 0);
LED1_PIN = 1;
length = 7;
strcpy(&packet[0],"PAYLOAD");
RFIdle();
RFTransmit(&packet[0],length);
LED1_PIN = 0;
RFIdle();
RFReceive();
}
break;
// On PB1, a packet send is initiated
// wait for release of the button
// blink the LED
// send a packet (64 bytes payload)
// set packet content
// disable receiving
// start packet transmission
// release the LED
// disable transmission
// start continuous receive again
At this point, the program is tests the packet length prior to a direct packet
validation, blinking LED2 if expected packet data is received.
case RF_PACKET_RECEIVED:
// a packet received
RFIdle();
// disable the receiver
if ( length == 7 )
// check packet content is valid
{
if ( memcmp(&packet[0], "PAYLOAD", 7) == 0 )
{
LED2_PIN = 1; // blink LED2 if packet received
delay_ms(100);
LED2_PIN = 0;
}
}
RFReceive();
// restart continuous receive
break;
Rev. 0.4
49