佚名通过本文主要向大家介绍了si4463中文pdf,si4463 pdf,stm32驱动si4463,si4463 wds,si4463 datasheet等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题:STC单片机和si4463模块调试
描述:
无线模块si4463
无线模块一直驱动不了求大侠指导
#include "reg51.h"
//#include "radio_config_Si4463.h"
#include <intrins.h>
#define MASTER //define:master undefine:slave
#define FOSC 11059200L
#define BAUD (256 - FOSC / 32 / 2400)
typedef unsigned char BYTE;
typedef unsigned int WORD;
typedef unsigned long DWORD;
sfr AUXR = 0x8e; //Auxiliary register
sfr SPSTAT = 0xcd; //SPI status register
#define SPIF 0x80 //SPSTAT.7
#define WCOL 0x40 //SPSTAT.6
sfr SPCTL = 0xce; //SPI control register
#define SSIG 0x80 //SPCTL.7
#define SPEN 0x40 //SPCTL.6
#define DORD 0x20 //SPCTL.5
#define MSTR 0x10 //SPCTL.4
#define CPOL 0x08 //SPCTL.3
#define CPHA 0x04 //SPCTL.2
#define SPDHH 0x00 //CPU_CLK/4
#define SPDH 0x01 //CPU_CLK/16
#define SPDL 0x02 //CPU_CLK/64
#define SPDLL 0x03 //CPU_CLK/128
sfr SPDAT = 0xcf; //SPI data register
sbit SPISS = P1^4; //SPI slave select, connect to slave' SS(P1.4) pin
sbit Irq = P3^2;
sbit EZRP_SDN = P0^4;
sfr P3M0 = 0xB2; // 0000,0000
sfr P3M1 = 0xB1; // 0000,0000
#define SI_CSN_LOW( ) SPISS=0;
#define SI_CSN_HIGH( ) SPISS=1;
#define MAX_CTS_RETRY 2500
void InitUart();
void InitSPI();
void SendUart(BYTE dat); //send data to PC
BYTE RecvUart(); //receive data from PC
BYTE SPISwap(BYTE dat); //swap SPI data between master and slave
BYTE bApi_SendCommand(BYTE bCmdLength, BYTE *pbCmdData);
void bSpi_SendDataNoResp(BYTE bCmdLength, BYTE *pbCmdData);
void bSpi_SendDataGetResp(BYTE GetRespLength,BYTE *GetResp);
BYTE vApi_WaitforCTS(void);
BYTE bApi_GetResponse(BYTE bRespLength, BYTE *pbRespData);
void Delay10ms();
void Delay100us();
BYTE abApi_Write[64]={0};
BYTE abApi_Read[64]={0};
void main()
{
BYTE i;
WORD wDelay;
InitUart(); //initial UART
InitSPI(); //initial SPI
Irq=1;
// Reset the radio
EZRP_SDN = 1;
// Wait ~300us (SDN pulse width)
for(wDelay=0; wDelay<330; wDelay++);
// Wake up the chip from SDN
EZRP_SDN = 0;
// Wait for POR (power on reset); ~5ms
for(wDelay=0; wDelay<5500; wDelay++);
// Start the radio
for(i=0;i<64;i++)
{abApi_Write[i]=0;}
abApi_Write[0] = 0x02; // Use API command to power up the radio IC
abApi_Write[1] = 0x01; // Write global control registers
abApi_Write[2] = 0x00; // Write global control registers //使用内部晶振
abApi_Write[3] = 0x01; //30M
abApi_Write[4] = 0xc9;
abApi_Write[5] = 0xc3;
abApi_Write[6] = 0x80;
bApi_SendCommand(7,abApi_Write); // Send command to the radio IC
// Wait for boot
while(vApi_WaitforCTS()); // Wait for CTS
// Read CTs, clear pending ones
for(i=0;i<64;i++)
{abApi_Write[i]=0;}
abApi_Write[0] = 0x20; // Use interrupt status command
abApi_Write[1] = 0; // Clear PH_CLR_PEND
abApi_Write[2] = 0; // Clear MODEM_CLR_PEND
abApi_Write[3] = 0; // Clear CHIP_CLR_PEND
bApi_SendCommand(4,abApi_Write); // Send command to the radio IC
for(i=0;i<64;i++)
{abApi_Read[64]=0;}
bApi_GetResponse(8,abApi_Read); // Make sure that CTS is ready, then get&n
描述:
单片机调试spi si446xstc
单片机STC12LE5A08S2无线模块si4463
无线模块一直驱动不了求大侠指导
#include "reg51.h"
//#include "radio_config_Si4463.h"
#include <intrins.h>
#define MASTER //define:master undefine:slave
#define FOSC 11059200L
#define BAUD (256 - FOSC / 32 / 2400)
typedef unsigned char BYTE;
typedef unsigned int WORD;
typedef unsigned long DWORD;
sfr AUXR = 0x8e; //Auxiliary register
sfr SPSTAT = 0xcd; //SPI status register
#define SPIF 0x80 //SPSTAT.7
#define WCOL 0x40 //SPSTAT.6
sfr SPCTL = 0xce; //SPI control register
#define SSIG 0x80 //SPCTL.7
#define SPEN 0x40 //SPCTL.6
#define DORD 0x20 //SPCTL.5
#define MSTR 0x10 //SPCTL.4
#define CPOL 0x08 //SPCTL.3
#define CPHA 0x04 //SPCTL.2
#define SPDHH 0x00 //CPU_CLK/4
#define SPDH 0x01 //CPU_CLK/16
#define SPDL 0x02 //CPU_CLK/64
#define SPDLL 0x03 //CPU_CLK/128
sfr SPDAT = 0xcf; //SPI data register
sbit SPISS = P1^4; //SPI slave select, connect to slave' SS(P1.4) pin
sbit Irq = P3^2;
sbit EZRP_SDN = P0^4;
sfr P3M0 = 0xB2; // 0000,0000
sfr P3M1 = 0xB1; // 0000,0000
#define SI_CSN_LOW( ) SPISS=0;
#define SI_CSN_HIGH( ) SPISS=1;
#define MAX_CTS_RETRY 2500
void InitUart();
void InitSPI();
void SendUart(BYTE dat); //send data to PC
BYTE RecvUart(); //receive data from PC
BYTE SPISwap(BYTE dat); //swap SPI data between master and slave
BYTE bApi_SendCommand(BYTE bCmdLength, BYTE *pbCmdData);
void bSpi_SendDataNoResp(BYTE bCmdLength, BYTE *pbCmdData);
void bSpi_SendDataGetResp(BYTE GetRespLength,BYTE *GetResp);
BYTE vApi_WaitforCTS(void);
BYTE bApi_GetResponse(BYTE bRespLength, BYTE *pbRespData);
void Delay10ms();
void Delay100us();
BYTE abApi_Write[64]={0};
BYTE abApi_Read[64]={0};
void main()
{
BYTE i;
WORD wDelay;
InitUart(); //initial UART
InitSPI(); //initial SPI
Irq=1;
// Reset the radio
EZRP_SDN = 1;
// Wait ~300us (SDN pulse width)
for(wDelay=0; wDelay<330; wDelay++);
// Wake up the chip from SDN
EZRP_SDN = 0;
// Wait for POR (power on reset); ~5ms
for(wDelay=0; wDelay<5500; wDelay++);
// Start the radio
for(i=0;i<64;i++)
{abApi_Write[i]=0;}
abApi_Write[0] = 0x02; // Use API command to power up the radio IC
abApi_Write[1] = 0x01; // Write global control registers
abApi_Write[2] = 0x00; // Write global control registers //使用内部晶振
abApi_Write[3] = 0x01; //30M
abApi_Write[4] = 0xc9;
abApi_Write[5] = 0xc3;
abApi_Write[6] = 0x80;
bApi_SendCommand(7,abApi_Write); // Send command to the radio IC
// Wait for boot
while(vApi_WaitforCTS()); // Wait for CTS
// Read CTs, clear pending ones
for(i=0;i<64;i++)
{abApi_Write[i]=0;}
abApi_Write[0] = 0x20; // Use interrupt status command
abApi_Write[1] = 0; // Clear PH_CLR_PEND
abApi_Write[2] = 0; // Clear MODEM_CLR_PEND
abApi_Write[3] = 0; // Clear CHIP_CLR_PEND
bApi_SendCommand(4,abApi_Write); // Send command to the radio IC
for(i=0;i<64;i++)
{abApi_Read[64]=0;}
bApi_GetResponse(8,abApi_Read); // Make sure that CTS is ready, then get&n