欢迎来到天天文库
浏览记录
ID:43767957
大小:530.04 KB
页数:16页
时间:2019-10-14
《基于51的CC1101接收程序》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、#include#include#defineINT8Uunsignedchar#defineINT16Uunsignedint#defineWRITE_BURST0x40#defineREAD_SINGLE0x80#defineREADBURSTOxCO#defineBYTES_IN_RXFIFO0x7F字节数#defineCRCOK0x80〃连续写入〃读//连续读〃接收缓冲区的有效//CRC校验通过位标志************//■立•二•■立•匕•上■上■立■匕■立■立■上■立■立■上■上^3^■上•X*•卜•上•卜•上•上•上•上•上•上•丄•
2、•i*•丄•f/■[・*1*吟.*T**T*彳.彳.彳.彳.彳.彳.彳.彳.彳.*T*彳.彳.3、w^4、wrTwsbitledO=POAO;sbitled5、1二POT;sbitled2=P0A2;voidSpilnit(void);voidCpulnit(void);voidRESET_CC1100(void);voidPOWER_UP_RESET_CC1100(void);voidhalSpiWriteReg(INT8Uaddr,INT8Uvalue);voidhalSpiWriteBurstReg(INT8Uaddr,INT8U^buffer,INT8Ucount);voidhalSpiStrobe(INT8Ustrobe);INT8UhalSpiReadReg(INT8Uaddr);voidhalSpiReadBurstReg(INT8Ua6、ddr,INT8U^buffer,INT8Ucount);INT8UhalSpiReadStatus(INT8Uaddr);voidhalRfWriteRfSettings(void);voidhalRfSendPacket(INT8U*txBuffer,INT8Usize);INT8UhalRfReceivePcicket(INT8U*rxBuffer,INT8U^length);************//CC1100STROBE,CONTROLANDSTATUSREGSITER#defineCCxxxO_IOCFG20x00//GDO2outputpinconfiguration#def7、ineCCxxxOJOCFGl0x01//GDO1outputpinconfiguration#defineCCxxxOJOCFGO0x02//GDOOoutputpinconfiguration#defineCCxxxO_FIFOTHR0x03//RXFIFOandTXFIFOthresholds#defineCCxxxO.SYNCl0x04//Syncword,highINT8U#defineCCxxxO.SYNCO0x05//Syncword,lowINT8U#defineCCxxxO_PKTLEN0x06//Packetlength#defineCCxxxO_PKTCTRLl0x07/8、/Packetautomationcontrol#defineCCxxxO_PKTCTRLO0x08//Packetautomationcontrol#defineCCxxxO_ADDR0x09//Deviceaddress#defineCCxxxO.CHANNROxOA//Channelnumber#defineCCxxxO_FSCTRL1OxOB//Frequencysynthesizercontrol#defineCCxxxO_FSCTRLOOxOC//Frequencysynthesizercontrol#defineCCxxxO_FREQ2OxOD//Frequencycontrol9、word,highINT8U#defineCCxxxO_FREQ1OxOE//Frequencycontrolword,middleINT8U#defineCCxxxO.FREQOOxOF//Frequencycontrolword,lowINT8U#defineCCxxxO_MDMCFG40x10//Modemconfiguration#defineCCxxxO_MDMCFG3Oxll//Mod
3、w^
4、wrTwsbitledO=POAO;sbitled
5、1二POT;sbitled2=P0A2;voidSpilnit(void);voidCpulnit(void);voidRESET_CC1100(void);voidPOWER_UP_RESET_CC1100(void);voidhalSpiWriteReg(INT8Uaddr,INT8Uvalue);voidhalSpiWriteBurstReg(INT8Uaddr,INT8U^buffer,INT8Ucount);voidhalSpiStrobe(INT8Ustrobe);INT8UhalSpiReadReg(INT8Uaddr);voidhalSpiReadBurstReg(INT8Ua
6、ddr,INT8U^buffer,INT8Ucount);INT8UhalSpiReadStatus(INT8Uaddr);voidhalRfWriteRfSettings(void);voidhalRfSendPacket(INT8U*txBuffer,INT8Usize);INT8UhalRfReceivePcicket(INT8U*rxBuffer,INT8U^length);************//CC1100STROBE,CONTROLANDSTATUSREGSITER#defineCCxxxO_IOCFG20x00//GDO2outputpinconfiguration#def
7、ineCCxxxOJOCFGl0x01//GDO1outputpinconfiguration#defineCCxxxOJOCFGO0x02//GDOOoutputpinconfiguration#defineCCxxxO_FIFOTHR0x03//RXFIFOandTXFIFOthresholds#defineCCxxxO.SYNCl0x04//Syncword,highINT8U#defineCCxxxO.SYNCO0x05//Syncword,lowINT8U#defineCCxxxO_PKTLEN0x06//Packetlength#defineCCxxxO_PKTCTRLl0x07/
8、/Packetautomationcontrol#defineCCxxxO_PKTCTRLO0x08//Packetautomationcontrol#defineCCxxxO_ADDR0x09//Deviceaddress#defineCCxxxO.CHANNROxOA//Channelnumber#defineCCxxxO_FSCTRL1OxOB//Frequencysynthesizercontrol#defineCCxxxO_FSCTRLOOxOC//Frequencysynthesizercontrol#defineCCxxxO_FREQ2OxOD//Frequencycontrol
9、word,highINT8U#defineCCxxxO_FREQ1OxOE//Frequencycontrolword,middleINT8U#defineCCxxxO.FREQOOxOF//Frequencycontrolword,lowINT8U#defineCCxxxO_MDMCFG40x10//Modemconfiguration#defineCCxxxO_MDMCFG3Oxll//Mod
此文档下载收益归作者所有