msp430与A7105实现单工通信
先说一下大致流程:
Master端:
1)timer=0ms 发送数据(采用调频发送)
Slaver端:
2)timer=2ms接收数据,并送给PC
程序代码:
//===================================================================================
//da
//功能:常量与全局变量定义
//代码:
//=========================================================
//常量定义
#define uint unsigned int
#define SCS BIT7
#define SCK BIT6
#define SDIO BIT5
#define GPIO1 BIT1
#define GPIO2 BIT0
#define maslv 0
#define MODE_REG 0x00
#define IDCODE_REG 0x06
#define PLL1_REG 0x0F
#define FIFO_REG 0x05
#define VCOCAL1_REG 0x25
#define CALIBRATION_REG 0x22
#define VCOCCAL_REG 0x24
#define VCOCAL2_REG 0x26
#define VCOCAL1_REG 0x25
#define CMD_STBY 0xA0
#define CMD_TX 0xD0
#define CMD_RX 0xC0
#define CMD_PLL 0xB0
//==============================================================
//===================================================================
uint Seq;//实现调频的变量
uint RxCnt;//计数
uint tmpbuf[64]={0};
uint timer;
//====================================================================
//============================================================
//RF初始设定
const uint A7105Config[]=
{
0x00, // reset register,on
0x42,//mode register
0x00,//Calibratin register,on
0x3F,//FIFo1 register
0x00,//FIFO2 register
0x00,//FIFO register
0x00,//IDDATA register
0x00,//rcosc1 register
0x00,//rcosc2 register
0x00,//rcosc3 register
0x00,//cko register
0x01,//gpio1 register
0x21,//gpio2 register
0x05,//clock register
0x00,//datarate register
0x50,//pll1 register
0x9E,//pll2 register
0x4B,//pll3 register
0x00,//pll4 register
0x02,//pll5 register
0x16,//tx1 register
0x2B,//tx2 register
0x12,//delay1 register
0x00,//delay2 register
0x62,//rx register
0x80,//rxgain1 register
0x80,//rxgain2 register
0x00,//rxgain3 register
0x0A,//rxgain4 register
0x32,//rssi register
0xC3,//ADC register
0x07,//co
0x16,//co
0x00,//co
0x00,//ifcal1 register
0x00,//ifcal2 register, on
0x00,//vcoccal register
0x00,//vcocal1 register
0x3B,//vcocal2 register
0x00,//battery register
0x17,//txtest register
0x47,//rxdem1 register
0x80,//rxdem2 register
0x03,//cpc register
0x01,//crystal register
0x45,//plltest register
0x18,//vcotest1 register
0x00,//vcotest2 register
0x01,//ifat register
0x0F,//rscale register
0x00 //filtertest
};//=============================================================
//=============================================================
const uint ID_Tab[4]={0x54,0x75,0xC5,0x2A};//ID co
//============================================================
//============================================================
const uint PN9_Tab[]={
0x00,0x83,0xDF,0x17,0x32,0x09,0x4E,0xD1,
0xE7,0xCD,0x8A,0x91,0xC6,0xD5,0xC4,0xC4,
0x40,0x21,0x18,0x4E,0x55,0x86,0xF4,0xDC,
0x8A,0x15,0xA7,0xEc,0x92,0xDF,0x93,0x53,
0x30,0x18,0xCA,0x43,0xBF,0xA2,0xC7,0x59,
0x67,0x8F,0xBA,0x0D,0x6D,0xD8,0x2D,0x7D,
0x54,0x0A,0x57,0x97,0x70,0x39,0xD2,0x7A,
0xEa,0x24,0x33,0x85,0xED,0x9A,0x1D,0xE0
};//Tish table are 64bytes PN9 pseduorandom co
//===================================================================
//==================================================================
//自由定义的调频值
uint HopTab[]=
{
20,//2410
40,//2420
80,//2440
120,//2460
160,//2480
};
//===================================================================
//==========================================================
//fuction.c 文件
//功能:函数声明
//代码:
//=====================================================
//函数声明
void A7105_Reset(void);
void A7105_WriteReg(uint,uint);
uint A7105_ReadReg(uint);
void ByteSend(uint src);
uint ByteRead(void);
void A7105_WriteID(void);
void A7105_WriteFIFO(void);
msp430A7105单工通 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)