Set SCK high..
uchar |= MISO; // capture current MISO bit
SCK = 0; // ..then set SCK low again
}
return(uchar); // return read uchar
}
/****************************************************************************************************
/*函数:uchar SPI_Read(uchar reg)
/*功能:NRF24L01的SPI时序
/****************************************************************************************************/
uchar SPI_Read(uchar reg)
{
uchar reg_val;
CSN = 0; // CSN low, initialize SPI communication...
SPI_RW(reg); // Select register to read from..
reg_val = SPI_RW(0); // ..then read registervalue
CSN = 1; // CSN high, terminate SPI communication
return(reg_val); // return register value
}
/****************************************************************************************************/
/*功能:NRF24L01读写寄存器函数
/****************************************************************************************************/
uint SPI_RW_Reg(uchar reg, uchar value)
{
uint status;
CSN = 0; // CSN low, init SPI transaction
status = SPI_RW(reg); // select register
SPI_RW(value); // ..and write value to it..
CSN = 1; // CSN high again
return(status); // return nRF24L01 status uchar
}
/****************************************************************************************************/
/*函数:uint SPI_Read_Buf(uchar reg, uchar *pBuf, uchar uchars)
/*功能: 用于读数据,reg:为寄存器地址,pBuf:为待读出数据地址,uchars:读出数据的个数
/****************************************************************************************************/
uint SPI_Read_Buf(uchar reg, uchar *pBuf, uchar uchars)
{
uint status,uchar_ctr;
CSN = 0; // Set CSN low, init SPI tranaction
status = SPI_RW(reg); // Select register to write to and read status uchar
for(uchar_ctr=0;uchar_ctr<uchars;uchar_ctr++)
pBuf[uchar_ctr] = SPI_RW(0); //
CSN = 1;
return(status); // return nRF24L01 status uchar
}
/*********************************************************************************************************
/*函数:uint SPI_Write_Buf(uchar reg, uchar *pBuf, uchar uchars)
/*功能: 用于写数据:为寄存器地址,pBuf:为待写入数据地址,uchars:写入数据的个数
/*********************************************************************************************************/
uint SPI_Write_Buf(uchar reg, uchar *pBuf, uchar uchars)
{
uint status,uchar_ctr;
CSN = 0; //SPI使能
status = SPI_RW(reg);
for(uchar_ctr=0; uchar_ctr<uchars; uchar_ctr++) //
SPI_RW(*pBuf++);
CSN = 1; //关闭SPI
return(status); //
}
/****************************************
关于NRF24L01无线模块的C52双向通讯C程序(中文详解)_IT/计算机_专业资料。#...SCK = 1; // 拉高SCK,nRF24L01从MOSI读入1位数据,同时从MISO输出1位数据...
STC11L02E 单片机和NRF24L01无线模块程序_IT/计算机_专业资料。STC11L02E 单片机...'RF setup' register address #define STATUS 0x07 // 'Status' register ...
NRF24L01参考程序(包含多... 11页 1下载券nRF24l01无线模块 发送端程序fo...
NRF24L01+无线模块详细规格介绍说明书,介绍模块详细资料供工程师参考选择 。... nRF24L01无线模块在单片... 9页 免费 NRF24L01无线模块程序 5页 免费...
nrf24l01是适合初学入门的无线模块_信息与通信_工程科技_专业资料。nrf24l...nrf24l01 的 51 驱动程序 2010-11-13 18:58 随着物联网时代的到来,无线...
nRF24L01无线通信模块_信息与通信_工程科技_专业资料。nRF24L01 无线通信模块 模块与 AT89S52 单片机接口电路 发送程序流程图: 开始 读状态寄存器 接收到数据...
23CSN= 1;// CSN high again 24return(status);// return nRF24L01 status... NRF24L01参考程序(包含多... 11页 5下载券 nRF24l01无线模块 发送端....
nrf24l01无线模块_哲学_高等教育_教育专区。nrf24l01无线模块...对 RF24L01 的读写程序代码如下: nRF24L01 的 ShockBurst 和 Enhanced ...
MSP430G2553_NRF24L01无线模块发送程序_电子/电路_工程科技_专业资料。MSP430G2553(51单片机) NRF24L01 无线模块发送程序main - Printed on 2015/2/10 15:...
热门文档