Die Init von meinem RFM 02 schaut so aus:
Code:
volatile unsigned char uc_frequ[2]; /* Frequenz tuningword */
uc_frequ[1]=ui_frequ[uc_kanal]/256;
uc_frequ[1]|=0b10100000;
uc_frequ[0]=ui_frequ[uc_kanal]%256;
/* Configuration Setting: 433MHz, CLK 5MHz, 11,5pf Kapaz., +/-60kHz */
#asm ("cbi portb,nsel");
sendbyte(0b10001110);
sendbyte(0b01100000);
#asm ("sbi portb,nsel");
#asm ("nop");
/* Frequency Setting: eingestellter Kanal*/
#asm ("cbi portb,nsel");
sendbyte(uc_frequ[1]);
sendbyte(uc_frequ[0]);
#asm ("sbi portb,nsel");
#asm ("nop");
/* Output Power Command: Max Power */
#asm ("cbi portb,nsel");
sendbyte(0b10110000);
#asm ("sbi portb,nsel");
#asm ("nop");
/* Data Rate Command: 2400 bit/s */
#asm ("cbi portb,nsel");
sendbyte(0b11001000);
sendbyte(0b10001111);
#asm ("sbi portb,nsel");
#asm ("nop");
/* Low Batt + Sync Command: enable Sync Circuit */
#asm ("cbi portb,nsel");
sendbyte(0b11000010);
sendbyte(0b00100000);
#asm ("sbi portb,nsel");
#asm ("nop");
/* PLL Setting Command: 0xD240 up to 19,2kbit/s*/
#asm ("cbi portb,nsel");
sendbyte(0b11010010);
sendbyte(0b01000000);
#asm ("sbi portb,nsel");
#asm ("nop");
/* Power Managment Command= Enable Clock; disable Synthesizer; disable pow. Ampl. */
#asm ("cbi portb,nsel");
sendbyte(0b11000000);
sendbyte(0b00100000);
#asm ("sbi portb,nsel");
Das Frequenz Setting Word wird bei mir von einer Tabelle und DIP FIX Schaltern gesteuert.
Hier die Tabelle:
Code:
flash unsigned int ui_frequ[32]={1240,1270,1300,1330,1360,1390,1420,1450,1480,1510,1540,1570,1600,1630,1660,1690,1720,1750,1780,1810,1840,1870,1900,1900,1900,1900,1900,1900,1900,1900,1900,1900};
Vieleicht hilft Dir das ja weiter.
Lesezeichen