CC2500无线模块初始化C代码
#include "CC2500.h"
//--------------------------------------------
void CC2500_Txing(void);
uint8 CC2500_RxPacket(void) ;
void CC2500_TxPacket(void);
uint8 CC2500_ReadReg(uint8 addr) ;
void CC2500_WriteBurstReg(uint8 addr, uint8 *buffer, uint8 count) ;
void CC2500_ReadBurstReg(uint8 addr, uint8 *buffer, uint8 count) ;
void CC2500_Write_RxADDR(void);
//void CC2500_Write_TxADDR(void);
//void CC2500_Write_TxADDR(uint8 Add);
//void CC2500_FH(uint8 feq);
//--------------------------------------------
uint8 CC2500_TxRxBuf[1+CC2500_DATA_LEN ];
uint8 CC2500_TxBuf[CC2500_DATA_LEN ];
uint8 CC2500_RxBuf[CC2500_DATA_LEN ];
uint8 Channr_Num=0;
//uint16 CC2500_Error_Count=0;
code uint8 PaTabel[8] = {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff};
//--------------------------CC2500 寄存器配置---------------------------------
code CC2500_RF_SETTINGS CC2500_Config =
{
0x0B, //IOCFG2 GDO2 output pin configuration.
0x06, //IOCFG1
0x06, //IOCFG0 GDO0 output pin configuration.
0x07, //FIFOTHR
0xD3, //SYNC1 MSB
0x91, //SYNC0 LSB
1+CC2500_DATA_LEN, // PKTLEN Packet length.
0x02, // PKTCTRL1 Packet automation control.
0x44, // PKTCTRL0 Packet automation control.
0x02, // ADDR 设备地址
0x00, // CHANNR 信道编号
0x0A, // FSCTRL1 Frequency synthesizer control.
0x00, // FSCTRL0 Frequency synthesizer control.
0x5D, // FREQ2 Frequency control word, high byte.
0x44, // FREQ1 Frequency control word, middle byte.
0xEC, // FREQ0 Frequency control word, low byte.
0x2D, // MDMCFG4 Modem configuration.
0x3B, // MDMCFG3 Modem configuration.
0x73, // MDMCFG2 Modem configuration.
0x23, // MDMCFG1 Modem configuration.
0x3B, // MDMCFG0 Modem configuration.
0x01, // DEVIATN Modem deviation setting (when FSK modulation is enabled).
0x07, // MCSM2 Main Radio Control State Machine configuration.
0x30, // MCSM1 Main Radio Control State Machine configuration.
0x18, // MCSM0 Main Radio Control State Machine configuration.
0x1D, // FOCCFG Frequency Offset Compensation Configuration.
0x1C, // BSCFG Bit synchronization Configuration.
0xC7, // AGCCTRL2 AGC control.
0x00, // AGCCTRL1 AGC control.
0xB0, // AGCCTRL0 AGC control.
0x00, // WOREVT1
0x00, // WOREVT0
0x00, // WORCTRL
0xB6, // FREND1 Front end RX configuration.
0x10, // FREND0 Front end RX configuration.
0xEA, // FSCAL3 Frequency synthesizer calibration.
0x0A, // FSCAL2 Frequency synthesizer calibration.
0x00, // FSCAL1 Frequency synthesizer calibration.
0x11, // FSCAL0 Frequency synthesizer calibration.
0x00, //RCCTRL1
0x00, //RCCTRL0
0x59, // FSTEST Frequency synthesizer calibration.
0x7F, //PTEST
0x3F, //AGCTEST
0x88, // TEST2 Various test settings.
0x31, // TEST1 Various test setting


