基于CC1101與STC89C52無線收發(fā)程序(發(fā)射程序)
#include
#include
#define IOCFG2
#define IOCFG1
#define IOCFG0
#define FIFOTHR
#define SYNC1
#define SYNC0
#define PKTLEN
#define PKTCTRL1
#define PKTCTRL0
#define ADDR
#define CHANNR
#define FSCTRL1
#define FSCTRL0
#define FREQ2
#define FREQ1
#define FREQ0
#define MDMCFG4
#define MDMCFG3
#define MDMCFG2
#define MDMCFG1
#define MDMCFG0
#define DEVIATN
#define MCSM2
#define MCSM1
#define MCSM0
#define FOCCFG
#define BSCFG
#define AGCCTRL2
#define AGCCTRL1
#define AGCCTRL0
#define WOREVT1
#define WOREVT0
#define WORCTRL
#define FREND1
#define FREND0
#define FSCAL3
#define FSCAL2
#define FSCAL1
#define FSCAL0
#define RCCTRL1
#define RCCTRL0
#define FSTEST
#define PTEST
#define AGCTEST
#define TEST2
#define TEST1
#define TEST0
#define SRES
#define
#define SXOFF
#define SCAL
#define SRX
#define STX
#define SIDLE
#define SAFC
#define SWOR
#define SPWD
#define SFRX
#define SFTX
#define SWORRST
#define SNOP
#define PARTNUM
#define VERSION
#define FREQEST
#define LQI
#define RSSI
#define MARCSTATE
#define WORTIME1
#define WORTIME0
#define PKTSTATUS
#define VCO_VC_DAC
#define TXBYTES
#define RXBYTES
#define PATABLE
#define TX_FIFO
#define RX_FIFO
#define data_len
typedef
typedef
uchar rx_buffer[data_len]={0,0,0,0,0,0,0,0};//rx data
//uchar RX_data[data_len];
uchar code tx_buffer[data_len]={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f};//tx data
uchar data_length=0;
uchar code P_Config[]={0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0};//功率配置
sbit CSN=P2^1;
sbit SCLK=P2^7;
sbit SI=P2^2;
sbit SO=P2^0;
sbit GDO0=P2^6;
sbit key=P2^5;
sbit LED=P0^0;
//sbit LED1=P0^6;
void CC1101_Init(void);
void CC1101_RESET(void);
void POWER_UP_RESET(void);
uchar SPI_WR_Byte(uchar value);
void SPI_Write_Byte(uchar addr,uchar value);
uchar SPI_Read_Byte(uchar addr);
void SPI_Write_Strobe(uchar strobe);
void SPI_Write_Burst(uchar addr,uchar *buffer,uchar count);
void SPI_Read_Burst(uchar addr,uchar *buffer,uchar count);
void SPI_Write_Packet(uchar *TX_Buffer,uchar size);
uchar SPI_Read_Packet(uchar *RX_Buffer,uchar length);
void CC1101_Set_TX(void);
void CC1101_Set_RX(void);
void Write_Config(void);
void delay_ms(uint x)
{
}
void delay_us(uint x)
{
}
//------------------------------------------------/
//函數(shù)功能:通過SPI寫讀一字節(jié)
//輸入?yún)?shù):value
//輸出參數(shù):B_value
//-----------------------------------------------/
uchar SPI_WR_Byte(uchar value)
{
}
//-------------------------------------------------/
//函數(shù)功能:重置CC1101
//輸入?yún)?shù):無
//輸出參數(shù):無
//----------------------------------------------/
void CC1101_RESET(void)
{
}
//-----------------------------------------------/
//函數(shù)功能:CC1101上電重置
//輸入?yún)?shù):無
//輸出參數(shù):無
//--------------------------------------------/
void POWER_UP_RESET(void)
{
}
評(píng)論