基于无线网络的多点信息采集系统设计 联系客服

发布时间 : 星期一 文章基于无线网络的多点信息采集系统设计更新完毕开始阅读50d09dba760bf78a6529647d27284b73f3423667

基于无线网络的多点信息采集系统设计

// If in RX/TX: Go to a wait state where only the synthesizer is

// running (for quick RX / TX turnaround). #define CCxxx0_SXOFF 0x32 // Turn off crystal oscillator.

#define CCxxx0_SCAL 0x33 // Calibrate frequency synthesizer and turn it off

#define CCxxx0_SRX coming from IDLE and

#define CCxxx0_STX calibration first if

and CCA is enabled:

#define CCxxx0_SIDLE synthesizer and exit

#define CCxxx0_SAFC synthesizer

#define CCxxx0_SWOR (Wake-on-Radio)

#define CCxxx0_SPWD high.

#define CCxxx0_SFRX #define CCxxx0_SFTX #define CCxxx0_SWORRST #define CCxxx0_SNOP commands to two

// (enables quick start).

0x34 // Enable RX. Perform calibration first if // MCSM0.FS_AUTOCAL=1.

0x35 // In IDLE state: Enable TX. Perform // MCSM0.FS_AUTOCAL=1. If in RX state // Only go to TX if channel is clear.

0x36 // Exit RX / TX, turn off frequency // Wake-On-Radio mode if applicable. 0x37 // Perform AFC adjustment of the frequency 0x38 // Start automatic RX polling sequence 0x39 // Enter power down mode when CSn goes 0x3A // Flush the RX FIFO buffer. 0x3B // Flush the TX FIFO buffer. 0x3C // Reset real time clock.

0x3D // No operation. May be used to pad strobe 33

基于无线网络的多点信息采集系统设计

// INT8Us for simpler software. #define CCxxx0_PARTNUM 0x30 #define CCxxx0_VERSION 0x31 #define CCxxx0_FREQEST 0x32 #define CCxxx0_LQI 0x33 #define CCxxx0_RSSI 0x34 #define CCxxx0_MARCSTATE 0x35 #define CCxxx0_WORTIME1 0x36 #define CCxxx0_WORTIME0 0x37 #define CCxxx0_PKTSTATUS 0x38 #define CCxxx0_VCO_VC_DAC 0x39 #define CCxxx0_TXBYTES 0x3A #define CCxxx0_RXBYTES 0x3B #define CCxxx0_PATABLE 0x3E #define CCxxx0_TXFIFO 0x3F #define CCxxx0_RXFIFO 0x3F

/****************************************************************************** //函数名:delay(unsigned int s) //输入:时间 //输出:无

//功能描述:普通廷时,内部用

//**************************************************************************** static void delay(unsigned int s) { }

void halWait(INT16U timeout) {

unsigned int i; for(i=0; i

34

基于无线网络的多点信息采集系统设计 do { _nop_();

_nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_(); _nop_();

} while (--timeout); }

void SpiInit(void) { }

/****************************************************************************** //函数名:CpuInit() //输入:无 //输出:无

//功能描述:SPI初始化程序

CSN=0; SCK=0; CSN=1;

35

基于无线网络的多点信息采集系统设计

/****************************************************************************** void CpuInit(void) { }

//***************************************************************************** //函数名:SpisendByte(INT8U dat) //输入:发送的数据 //输出:无

//功能描述:SPI发送一个字节

//***************************************************************************** INT8U SpiTxRxByte(INT8U dat) {

INT8U i,temp; temp = 0; SCK = 0; for(i=0; i<8; i++) {

if(dat & 0x80) { }

else MOSI = 0; dat <<= 1; SCK = 1; _nop_(); _nop_(); temp <<= 1;

MOSI = 1;

SpiInit(); delay(5000);

36