A7105(2.4G)與STC89C52單片機無線收發(fā)程序(發(fā)射程序)
#include
#include
typedef unsigned int uint;
typedef unsigned char uchar;
#define MODE_REG
#define MODE_CONTROL_REG
#define CALIBRATION_REG
#define FIFO_REGISTER1_REG 0x03
#define FIFO_REGISTER2_REG 0x04
#define FIFO_DATA_REG
#define ID_DATA_REG
#define RC_OSC1_REG
#define RC_OSC2_REG
#define RC_OSC3_REG
#define CKO_CONTROL_REG
#define GIPO1_CONTROL_REG
#define GIPO2_CONTROL_REG
#define CLOCK_REG
#define DATA_RATE_REG
#define PLL1_REG
#define PLL2_REG
#define PLL3_REG
#define PLL4_REG
#define PLL5_REG
#define TX1_REG
#define TX2_REG
#define DELAY1_REG
#define DELAY2_REG
#define RX_REG
#define RX_GAIN1_REG
#define RX_GAIN2_REG
#define RX_GAIN3_REG
#define RX_GAIN4_REG
#define RSSI_THRESHOLD_REG 0x1d
#define ADC_CONTROL_REG
#define CODE1_REG
#define CODE2_REG
#define CODE3_REG
#define IF_CALIBRATION1_REG
#define IF_CALIBRATION2_REG
#define VCO_CURRENT_CAL_REG
#define VCO_SINGLE_BAND_CAL1_REG
#define VCO_SINGLE_BAND_CAL2_REG
#define BATTERY_DETECT_REG
#define TX_TEST_REG
#define RX_DEM_TEST1_ERG
#define RX_DEM_TEST2_REG
#define CPC_REG
#define CRYSTAL_TEST_REG
#define PLL_TEST_REG
#define VCO_TEST1_REG
#define VCO_TEST2_REG
#define IFAT_REG
#define RSSI_CALE_REG
#define FILTER_TEST_REG
//A7105命令定義
#define CMD_SLEEP
#define CMD_IDLE
#define CMD_STBY
#define CMD_PLL
#define CMD_RX
#define CMD_TX
#define CMD_TX_FIFO_RESET
#define CMD_RX_FIFO_RESET
//ID CODE define
#define ID_CODE0
#define ID_CODE1
#define ID_CODE2
#define ID_CODE3
#define RF_DATA_PACKET_SIZE
sbit SCK=P3^5;
sbit SCS=P3^4;
sbit SDIO=P3^6;
sbit GPIO1=P3^7;
sbit LED=P2^0;
sbit Key=P2^4;
const uchar code A7105_Default_Par[]=
{
};
uchar const Hop_Tab[]={20,40,80,120,160};
uchar RX_DATA_Buffer[RF_DATA_PACKET_SIZE];
const uchar code LED_BIT[]={0x00,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,
18,19,20,21,22,23,24,25,26,27,28,29,30,31,31,32,33,34,35,36,37,38,39,40,
41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,0x55,0xaa,0xff};
bit RX_Flag;
uchar timer,seq,Err_Hop_Ctn,timer_ctn;
uchar Read_ID[4];
void Init_A7105(void);
void A7105_Config_Chip(void);
void A7105_Calibration(void);
void A7105_Entry_Stdy(void);
void A7105_Setup_Wpll(void);
void A7105_Setup_Channel(uchar ch);
void A7105_Entry_TX(void);
void A7105_Entry_RX(void);
void A7105_Reset_Chip(void);
void A7105_Reset_RX_FIFO(void);
void A7105_Reset_TX_FIFO(void);
void Write_Register(uchar bits,uchar value);
uchar Read_Register(void);
void A7105_Write_Command(uchar cmd);
void A7105_Write_Register(uchar addr,uchar value);
uchar A7105_Read_Register(uchar addr);
void A7105_Write_ID(void);
void A7105_Read_ID(uchar *Read_Ptr);
void A7105_Write_DATA_To_FIFO(void);
void A7105_Read_DATA_From_FIFO(void);
void Send_DATA_By_RF(uchar Send_Byte);
void Rec_RF_DATA(void);
void delay_us(uint x)
{
}
void delay_ms(uint x)
{
}
評論