RF01 Programming Guide: 1 Brief Description
RF01 Programming Guide: 1 Brief Description
RF01 Programming Guide: 1 Brief Description
1
RF01 programming guide
1. Brief description
RF01 is a low cost FSK receive IC witch integrated all RF functions in a single
chip. It only need a MCU, a crystal, a decouple capacitor and antenna to build a
hi reliable FSK receiver. The operation frequency can cover 300 to 1000MHz.
RF01 can be used in applications such as remote control toys, wireless alarm,
wireless sensor, wireless keyboard/mouse, home-automation and wireless data
collection.
2. Commands
1. Timing diagram
bit 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 POR
1 0 0 b1 b0 eb et ex x3 x2 x1 x0 i2 i1 i0 dc 893Ah
1 1 0 67
1 1 1 reserved
1 1 0 0 1 1 0 0 d6 d5 d4 d3 d2 d1 d0 en CCOEh
1 1 0 0 0 0 1 0 d2 d1 d0 t4 t3 t2 t1 t0 C200h
CLK signal is derive form crystal oscillator and it can be applied to MCU clock in to save
a second crystal.
If not used, please set bit “dc” to disable CLK output
To integrate the load capacitor internal can not only save cost, but also adjust reference
frequency by software
r1 r0 range(fres)
0 0 No restriction fres
0 1 +15/-16 315,433band: 2.5kHz
1 0 +7/-8 868band: 5kHz
1 1 +3-4
915band: 7.5kHz
This command starts with a 0 and be used to read internal status register
DEMO
Init RF01
Open RX
Receive data
N
Check
pass?
Indicate receive
Receive data
N
Data recive
over?
Y
return
Note: After RF01 initialization, Open FIFO receive mode and wait nIRQ low, only then MCU can
read received and stored in FIFO data. For next package receive, please reset FIFO.
/********************************************************************
copyright (c) 2006
Title: RF01 simple example based on AVR C
Current version: v1.0
Function: Package Receive Demo
processor ATMEGA48
Clock: 10MHz Crystal
Operate frequency: 434MHz
Data rate: 4.8kbps
Package size: 23byte
Author: Tank
Company: Hope microelectronic Co.,Ltd.
Contact: +86-0755-86106557
E-MAIL: hopefsk@hoperf.com
Date: 2006-10-24
Connections
PC0~PC3: LED0~LED3
**********************************************************************/
#define DDR_IN 0
#define DDR_OUT 1
if(aCmd&0x8000){
aCmd<<=1;
};
LOW_SCK();
HI_SEL();
return(temp);
}
unsigned char RF01_RDFIFO(void){
unsigned char i,Result;
LOW_SCK();
LOW_SDI();
LOW_SEL();
for(i=0;i<16;i++){//skip status bits
HI_SCK();
HI_SCK();
LOW_SCK();
LOW_SCK();
}
Result=0;
for(i=0;i<8;i++){//read fifo data byte
Result<<=1;
if(SDO_HI()){
Result|=1;
}
HI_SCK();
HI_SCK();
LOW_SCK();
LOW_SCK();
};
HI_SEL();
return(Result);
}
void main(void)
{
unsigned int intI,intJ;
unsigned char i,j,ChkSum;
for(intI=0;intI<10000;intI++)for(intJ=0;intJ<123;intJ++);
RFXX_PORT_INIT();
DDRD&=~(1<<2);
LED_OUTPUT();
i=0;
while(1){
while(!(PIND&(1<<2))){//polling the nIRQ data
RF_RXBUF[i++]=RF01_RDFIFO();//read FIFO data
if(i==18){
i=0;
RFXX_WRT_CMD(0xCE84); //reset FIFO for next frame recognition
RFXX_WRT_CMD(0xCE87);
ChkSum=0;
for(j=0;j<16;j++){
ChkSum+=RF_RXBUF[j]; //calculate checksum
}
if(ChkSum==RF_RXBUF[16]){//frame check
LED0_TRG();//receive indication
}
}
}
}
}
/**********************************************************
copyright (c) 2006
Title: RF01 simple example based on PIC C
Current version: v1.0
Function: Package receive Demo
Processor PIC16F73
Clock: 10MHz Crystal
Operate frequency: 434MHz
Data rate: 4.8kbps
Package size: 23byte
Author: Robben
Company: Hope microelectronic Co.,Ltd.
Contact: +86-0755-86106557
E-MAIL: hopefsk@hoperf.com
Date: 2006-11-14
********************************************************/
#include "pic.h"
typedef unsigned char uchar;
typedef unsigned int uint;
void main()
{
uchar i=0,j=0;
uint CheckSum;
Delays();
RF1_Init( );
WriteCMD(0x0000);
WriteCMD(0x898A);//433BAND,134kHz
WriteCMD(0xA640);//434MHz
WriteCMD(0xC847);//4.8kbps
WriteCMD(0xC69B);//AFC setting
WriteCMD(0xC42A);//Clock recovery manual control,Digital filter,DQD=4
WriteCMD(0xC240);//output 1.66MHz
WriteCMD(0xC080);
WriteCMD(0xCE84);//use FIFO
WriteCMD(0xCE87);
uchar RF01_RDFIFO(void)
{
uchar i,Result;
SCK=0;
SDI=0;
nSEL=0;
for(i=0;i<16;i++)
{ //skip status bits
SCK=1;
NOP();
NOP();
SCK=0;
NOP();
NOP();
}
Result=0;
for(i=0;i<8;i++)
{ //read fifo data byte
Result=Result<<1;
if(SDO)
{
Result|=1;
}
SCK=1;
NOP();
NOP();
SCK=0;
NOP();
NOP();
}
nSEL=1;
return(Result);
}
void Delays(void)
{
uchar i=10;
while(i--)
{
Delayus(1);
}
}