Download Print this page

Advertisement

Quick Links

1.
Brief description
RF12B is a low cost FSK transceiver 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 transceiver system. The operation frequency can cover 400
to 1000MHz.
RF12B supports a command interface to setup frequency, deviation, output power
and also data rate. No need any hardware adjustment when using in frequency-hopping
applications
RF12B 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
2. Configuration Setting Command
bit
15
14
13
12
1
0
0
0
e l: Enable TX register
e f: Enable RX FIFO buffer
Tel: +86-755-82973805
RF12B programming guide
11
10
9
8
0
0
0
0
Fax: +86-755-82973550 E-mail: sales@hoperf.com http://www.hoperf.com
RF12 Program V1.1
7
6
5
4
3
el
ef
b1
b0
x3 x2 x1 x0
2
1
0
POR
8008h

Advertisement

loading
Need help?

Need help?

Do you have a question about the RF12B and is the answer not in the manual?

Questions and answers

Summary of Contents for Hope RF RF12B

  • Page 1 1. Brief description RF12B is a low cost FSK transceiver 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 transceiver system. The operation frequency can cover 400 to 1000MHz.
  • Page 2 RF12 Program V1.1 b1..b0: select band band[MHz] Reserved x3..x0: select crystal load capacitor load capacitor [pF] 10.0 …… …… 15.5 16.0 3. Power Management Command ebb et ex eb ew dc 8208h er: Enable receiver ebb:Enable base band block et: Enable transmitter es:...
  • Page 3 RF12 Program V1.1 5. Data Rate Command C623h r6..r0: Set data rate: BR=10000000/29/(R+1)/(1+cs*7) 6. Receiver Control Command P16 d1 9080h P16: select function of pin16 Interrupt input VDI output i2..i0:select baseband bandwidth Baseband Bandwidth [kHz] reserved reserved d1..d0: select VDI response time Response Fast...
  • Page 4 RF12 Program V1.1 r2..r0: select DRSSI threshold RSSIsetth [dBm] -103 Reserved Reserved The actual DRSSI threshold is related to LNA setup: RSSI = RSSI setth LNA. 7. Data Filter Command C22Ch al: Enable clock recovery auto-lock ml: Enable clock recovery fast mode s: select data filter type Filter type Digital filter...
  • Page 5 RF12 Program V1.1 9. Synchron pattern Command CED4h This command is used to reprogram the synchronic pattern; 10. Receiver FIFO Read Command B000h This command is used to read FIFO data when FFIT interrupt generated. FIFO data output starts at 8 SCK period.
  • Page 6 RF12 Program V1.1 12. TX Configuration Control Command m3 m2 m1 m0 p2 p1 p0 9800h m: select modulation polarity m2..m0: select frequency deviation: frequency deviation [kHz] p2..p0: select output power Output power[dBm] Tel: +86-755-82973805 Fax: +86-755-82973550 E-mail: sales@hoperf.com http://www.hoperf.com...
  • Page 7 RF12 Program V1.1 13. PLL Setting Command ddit CC77h ob1-ob0: Microcontroller output clock buffer rise and fall time control. Selected uC CLK frequency 5 or 10 MHz (recommended) 3.3 MHz 2.5 MHz or less ddy: phase detector delay enable. ddi: disables the dithering in the PLL loop. bw1-bw0: select PLL bandwidth Max bit rate [kbps] Phase noise at 1MHz offset [dBc/Hz]...
  • Page 8 RF12 Program V1.1 en:Enable low duty cycle mode 17. Low Battery Detector and Microcontroller Clock Divider Command C000h d2..d0: select frequency of CLK pin Clock frequency[MHz] 1.25 1.66 3.33 CLK signal is derive form crystal oscillator and it can be applied to MCU clock in to save a second crystal.
  • Page 9 Write a byte Package send over? return Note: Initialize RF12B and open transmitter, RF12B will transm it a byte and pull nIRQ low hen transmit over, then MCU can write next byte to transmit Tel: +86-755-82973805 Fax: +86-755-82973550 E-mail: sales@hoperf.com http://www.hoperf.com...
  • Page 10 Data recive over? return Note: After RF12B initialization, Open FIFO receive mode and wait nIRQ low, only then MCU can r ad received and stored in FIFO data. For next package receive, please reset FIFO. Tel: +86-755-82973805 Fax: +86-755-82973550 E-mail: sales@hoperf.com http://www.hoperf.com...
  • Page 11 RF12 Program V1.1 4. Example 1(for AVR microcontroller) RF12 transmitter de o: copyright (c) 2006 ;Title RF12 TX si mple example based on AVR C ;Company: Hope micro electronic Co.,Ltd. ;Author: Tank ;Current version: v1.0 ;Date: 2006-11-13 ;processor ATMEGA48 ;Clock: 10MHz Crystal ;Contact: +86-0755-86106557...
  • Page 12 RF12 Program V1.1 nclude <mega48.h> efine DDR_IN #define DDR_OUT #define PORT_SEL PORTB efine PIN_SEL PINB #define DDR_SEL DDRB #define PORT_SDI PORTB efine PIN_SDI PINB #define DDR_SDI DDRB #define PORT_SCK PORTB efine PIN_SCK PINB #define DDR_SCK DDRB #define PORT_SDO PORTB efine PIN_SDO PINB #define DDR_SDO DDRB...
  • Page 13 RF12 Program V1.1 #define SDO_HI() PIN_SDO&(1<<RFXX_SDO) #define SCK_OUTPUT() DDR_SCK |= (1<<RFXX_SCK) efine HI_SCK() PORT_SCK|= (1<<RFXX_SCK) #define LOW_SCK() PORT_SCK&=~ (1<<RFXX_SCK) #define RF12_DATA 4//PD4 efine DATA_OUT DDR_DATA|=1<<RF12_DATA #define HI_DATA PORT_DATA|=1<<R F12_DATA efine LEDG_OUTPUT() DDRD|=~(1<<6) #define LEDR_OUTPUT() DDRD|=~(1<<7) #define LEDG_ON() PORTD&=~(1<<6) #define LEDG_OFF() PORTD|=~(1<<6) #define LEDR_ON()
  • Page 14 RF12 Program V1.1 HI_SCK(); aCmd<<=1; LOW_SCK(); SEL(); return(temp); void RF12_INIT(void){ RFXX_WRT_CMD(0x80D7);//EL,EF,433band,1 2.0pF RFXX_WRT_CMD(0x8239);//!er,!ebb, ET,ES,EX,!eb,!ew,DC RFXX_WRT_CMD(0xA640);//A140=430.8MHz RFXX_WRT_CMD(0xC647);//4.8kbps RFXX_WRT_CMD(0x94A0);//VDI,FAST,134kHz,0dB m,-103dBm RFXX_WRT_CMD(0xC2AC);//AL,!ml,DIG,DQ RFXX_WRT_CMD(0xCA81);//FIFO8,SYNC,!ff,DR RFXX_WRT_CMD(0xCED4);//SYNC=2DD4; RFXX_WRT_CMD(0xC483);//@PWR,NO RSTRIC,!st,!fi,OE,EN RFXX_WRT_CMD(0x9850);//!mp,9810= 30kHz,MAX OUT RFXX_WRT_CMD(0xCC77);//OB1,OB0, !lpx,!ddy,DDIT,BW0 RFXX_WRT_CMD(0xE000);//NOT USE XX_WRT_CMD(0xC800);//NOT USE RFXX_WRT_CMD(0xC040);//1.66MHz,2.2V void RF12_SEND(unsigned char aByte) hile(PIND&(1<<2));//wait for previously TX over RFXX_WRT_CMD(0xB800+aByte);...
  • Page 15 RF12 Program V1.1 LEDR_OFF(); LEDG_OUTPUT(); LEDR_OUTPUT(); for(i=0;i<3;i+ Delay_ms(200) LEDG_ON(); LEDR_ON(); Delay_ms(200); EDG_OFF(); DR_OFF(); DG_OFF(); LEDR_OFF(); RFXX_PORT_INIT RF12_INIT(); DDRD|=(1<<RF12_DATA); RTD|=(1<<RF12_DATA);// SET nFFS pin HI when using TX register RD&=~(1<<2); //PD2(INT0) while(1){ LEDR_ON(); XX_WRT_CMD(0x0000);//read status register RFXX_WRT_CM D(0x8239);//!er,!ebb,ET,ES,EX,!eb,!ew,DC ChkSum=0; RF12_SEND(0xAA);//PREAMBLE RF12_SEND(0xAA);//PREAMBLE RF12_SEND(0xAA);//PREAMBLE RF12_SEND(0x2D);//SYNC HI BYTE RF12_SEND(0xD4);//SY NC LOW BYTE...
  • Page 16 RF12 Program V1.1 ChkSum+=0x34; RF12_SEND(0x35); ChkSum+=0x35; RF12_SEND(0x36); ChkSum+=0x36; RF12_SEND(0x37); ChkSum+=0x37; RF12_SEND(0x38); ChkSum+=0x38; RF12_SEND(0x39); ChkSum+=0x39; RF12_SEND(0x3A); ChkSum+=0x3A; RF12_SEND(0x3B); ChkSum+=0x3B; RF12_SEND(0x3C); ChkSum+=0x3C; RF12_SEND(0x3D); ChkSum+=0x3D; RF12_SEND(0x3E); ChkSum+=0x3E; RF12_SEND(0x3F); //DATA BYTE 15 ChkSum+=0x3F; RF12_SEND(ChkSum); //send chek RF12_SEND(0xAA);//DUMMY BYTE RF12_SEND(0xAA);//DUMMY BYTE RF12_SEND(0xAA);//DUMMY BYTE RFXX_WRT_CMD( 0x8201); LEDR_OFF();...
  • Page 17 RF12 Program V1.1 ;Current version: v1.0 ;Date: 2006-11-17 ;processor ATMEGA48 ;Clock: 10MHz Crystal ;Contact: +86-0755-86106557 -MAIL: hopefsk@hoperf.com Connections ATMEGA48 SIDE RF12 S SCK--------------->SCK MISO<---------------SDO MOSI--------------->SDI SS--------------->nSEL D4--------------->FSK/DATA INT0<----------- ----nIRQ PD6: LED GREEN PD7: LED RED nclude <mega48.h> efine DDR_IN #define DDR_OUT #define PORT_SEL PORTB efine PIN_SEL...
  • Page 18 RF12 Program V1.1 #define PORT_IRQ PORTD efine PIN_IRQ PIND #define DDR_IRQ DDRD #define PORT_DATA PORTD #define PIN_DATA PIND #define DDR_DATA DDRD #define PB7 7//--\ #define PB6 6// | #define RFXX_SCK 5// | #define RFXX_SDO 4// |RF _PORT #define RFXX_SDI 3// | #define RFXX_SEL 2// | efine NC...
  • Page 19 RF12 Program V1.1 #define LEDG_ON() PORTD&=~(1<<6) #define LEDG_OFF() PORTD|= (1<<6) #define LEDR_ON() PORTD&=~(1<<7) #defin e LEDR_OFF() PORTD|= (1<<7) void RFXX_POR T_INIT(void){ HI_SEL(); HI_SDI(); LOW_SCK(); //SET nFFS pin HI when using FIFO HI_DATA(); SEL_OUTPUT(); SDI_OUTPUT(); SDO_INPUT() SCK_OUTPUT(); RQ_IN(); DATA_OUT(); unsigned int RFXX_WRT_CM D(unsigned int aCmd){ unsigned char i;...
  • Page 20 RF12 Program V1.1 void RF12_INIT(void){ RFXX_WRT_CMD(0x80D7);//EL,EF,433band,1 2.0pF RFXX_WRT_CMD(0x82D9);//!er,!ebb, ET,ES,EX,!eb,!ew,DC RFXX_WRT_CMD(0xA640);//A140=430.8MHz RFXX_WRT_CMD(0xC647);//4.8kbps RFXX_WRT_CMD(0x94A0);//VDI,FAST,134kHz,0dB m,-103dBm RFXX_WRT_CMD(0xC2AC);//AL,!ml,DIG,DQ RFXX_WRT_CMD(0xCA81);//FIFO8,SYNC,!ff,DR RFXX_WRT_CMD(0xCED4);//SYNC=2DD4; RFXX_WRT_CMD(0xC483);//@PWR,NO RSTRIC,!st,!fi,OE,EN RFXX_WRT_CMD(0x9850);//!mp,9810= 30kHz,MAX OUT RFXX_WRT_CMD(0xCC77);//OB1,OB0, !lpx,!ddy,DDIT,BW0 RFXX_WRT_CMD(0xE000);//NOT USE RFXX_WRT _CMD(0xC800);//NOT USE RFXX_WRT_CMD(0xC040);//1.66MHz ,2.2V unsigned char RF12_ RECV(void){ unsigned int FIFO_data; WAIT_IRQ_LOW(); RFXX_WRT_CMD(0x0000); IFO_data=RFXX_WRT_CMD(0xB000); return(FIFO_data&0x00FF);...
  • Page 21 RF12 Program V1.1 Delay_ms(200); EDG_OFF(); DR_OFF(); LEDG_OFF(); LEDR_OFF(); Initialize command port RFXX_PORT_INIT(); Initialize RF12 chip RF12_INIT(); Init FIFO RFXX_WRT_CMD(0xCA 81); while(1){ //Enable FIFO RFXX_WRT_ CMD(0xCA83); ChkSum=0; //Receive payload data for(i=0;i <16;i++){ ChkSum+=RF12_RECV(); eceive Check sum i=RF12_RECV(); Disable FIFO RFXX_WRT_CMD(0xCA8 //Package chkec if(ChkSum==i){ LEDG_ON();...
  • Page 22 RF12 Program V1.1 5. Example 2(for PIC microcontroller) transmitter demo: /********************************************************** copyright (c) 2006 Title: RFM12B transmitter simple example based on PIC C Current version: v1.0 Function: Package send De Processor PIC16F73 DIP-28 Clock: 10MHz Cry stal Operate frequency: 434MHz Data rate: 4.8kbps Package size:...
  • Page 23 RF12 Program V1.1 #define nSEL #define SDI_OUT() TRISB7=0 #define SDO_IN() TRISB6=1 efine SCK_OUT() TRISB5=0 #define nSEL_OUT() TRISB4=0 void Init_RF12(void); void Write0( void ); void Write1( void ); void WriteCMD( uint CMD void DelayUs( uint us ); id DelayMs(uint ms); void WriteFSKbyte( uchar DATA );...
  • Page 24 RF12 Program V1.1 uint ChkSu m=0; Init_RF12( while(1) WriteCMD(0x8228); //OPEN PA DelayUs( 4 ); WriteCMD (0x8238); NOP(); NOP(); WriteFSKbyte( 0xAA ); WriteFSKbyte( 0xAA ); WriteFSKbyte( 0xAA ); WriteFSKbyte( 0x2D ); WriteFSKbyte( 0xD4 ); WriteFSKbyte( 0x30 );//DATA0 ChkSum+=0x30; WriteFSKbyte( 0x31 );// DATA1 ChkSum+=0x31;...
  • Page 25 RF12 Program V1.1 ChkSum+=0x3E; WriteFSKbyte( 0x 3F );//DATA15 ChkSum+=0x3F; ChkSum&=0x0FF; WriteFSKbyte( ChkSum ); WriteFSKbyte( 0x AA ); teCMD( 0x8208 ); //CLOSE PA elayMs(1000); void Write 0( void ) SCK=0; NOP(); SDI=0; NOP(); NOP(); NOP(); NOP(); NOP(); NOP(); NOP(); NOP(); NOP(); NOP();...
  • Page 26 RF12 Program V1.1 NOP(); NOP(); NOP(); NOP(); NOP(); NOP(); NOP(); NOP(); NOP(); NOP(); NOP(); NOP(); CK=1; NOP(); void WriteCMD( uint CMD ) uchar n=1 SCK=0; nSEL while(n--) if(CMD &0x8000) Write1(); else Write0(); CMD=C MD<<1; CK=0; nSEL=1; WriteFSKbyte( uchar DATA ) void uchar RGIT=0;...
  • Page 27 RF12 Program V1.1 RGIT else RGIT=0 SCK=0; SDI=1; nSEL if(RGIT==0) goto Loop; else RGIT WriteCMD(temp); void DelayU s( uint us ) uint i; while( us-- i=2; while( i-- ) NOP(); void DelayMs (uint ms) ar i; while(ms while(i--) DelayUs(1); Tel: +86-755-82973805 Fax: +86-755-82973550 E-mail: sales@hoperf.com http://www.hoperf.com...
  • Page 28 RF12 Program V1.1 receiver demo: /********************************************************** copyright (c) 2006 Title: RFM12B transmitter simple example based on PIC C Current version: v1.0 Function: Package send De Processor PIC16F73 DIP-28 Clock: 10MHz Cry stal Operate frequency: 434MHz Data rate: 4.8kbps Package size: 23byte Author: Robben...
  • Page 29 RF12 Program V1.1 void WriteCMD( uint CMD ); har RF12_RDFIFO(void); void Delayus( uint us ); __CONFIG(0x3FF2); bank1 uc har RF_RXBUF[19]; void Init_RF12(void) LED_OUT(); nSEL_OUT(); SDI_OUT(); SDO_IN(); SCK_OUT() nIRQ_IN( nSEL=1; SDI=1; SCK=0; SDO=0; LED=0; WriteCMD(0x80D8);//en able register,433MHz,12.5pF WriteCMD(0x82D8);//en able receive,!PA WriteCMD(0xA640);// WriteCMD(0xC647);// WriteCMD(0x94A0);//VD ,F I AST,134kHz,0dBm,-103dBm...
  • Page 30 RF12 Program V1.1 while(!nIRQ) RF_RX BUF[i++]=RF12_RDFIFO(); if(i==17) i=0; WriteCMD(0xCA80 WriteCMD(0xCA83); //reset FIFO and read to receive next Byte CheckSum=0; for(j=0;j<16;j++) CheckSum+=RF_RXBUF[j]; //add 0x 30-----0x3F Check Sum&=0x0FF; if(CheckSum ==RF_RXBUF[16]) LED=1; ayus(1); void Write 0( void ) SCK=0; NOP(); SDI=0; NOP(); NOP(); NOP();...
  • Page 31 RF12 Program V1.1 CK=1; NOP(); void Write 1( void ) SCK=0; NOP(); SDI=1; NOP(); NOP(); NOP(); NOP(); NOP(); NOP(); NOP(); NOP(); NOP(); NOP(); NOP(); NOP(); NOP(); NOP(); NOP(); CK=1; NOP(); void WriteCMD( uint CMD ) uchar n=1 SCK=0; nSEL while(n--) if(CMD &0x8000) Write1();...
  • Page 32 RF12 Program V1.1 uchar RF12_RDFIFO(v oid) 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 ult=Result<<1; if(SDO) Result |=1; SCK=1; NOP(); NOP(); SCK=0; P(); NOP(); EL=1; return(Result);...
  • Page 33 RF12 Program V1.1 NOP(); This document may contain preliminary information and is subject to change by Hope Microelectronics without notice. Hope Microelectronics assumes no responsibility or liability for any use of the information contained herein. Nothing in this document shall operate as an express HOPE MICROELECTRONICS CO.,LTD or implied license or indemnity under the intellectual property rights of Add:4/F, Block B3, East I...