nRF24L01+

nRF24L01+
nRF24L01+

All rights reserved.

Reproduction in whole or in part is prohibited without the prior written permission of the copyright holder.

March 2008

nRF24L01+

Single Chip 2.4GHz Transceiver

Preliminary Product Specification v1.0

Key Features

?Worldwide 2.4GHz ISM band operation ?250kbps, 1Mbps and 2Mbps on air data rates

?Ultra low power operation

?11.3mA TX at 0dBm output power ?13.5mA RX at 2Mbps air data rate ?900nA in power down ?26μA in standby-I

?On chip voltage regulator ? 1.9 to 3.6V supply range ?Enhanced ShockBurst? ?Automatic packet handling

?Auto packet transaction handling ? 6 data pipe MultiCeiver?

?Drop-in compatibility with nRF24L01

?

On-air compatible in 250kbps and 1Mbps with nRF2401A, nRF2402, nRF24E1 and nRF24E2

?Low cost BOM

?±60ppm 16MHz crystal ?5V tolerant inputs

?

Compact 20-pin 4x4mm QFN package

Applications

?Wireless PC Peripherals

?Mouse, keyboards and remotes ?3-in-1 desktop bundles

?Advanced Media center remote controls ?VoIP headsets ?Game controllers

?Sports watches and sensors

?RF remote controls for consumer electronics ?Home and commercial automation ?Ultra low power sensor networks ?Active RFID

?Asset tracking systems ?

Toys

nRF24L01+ Preliminary Product Specification

Liability disclaimer

Nordic Semiconductor ASA reserves the right to make changes without further notice to the product to improve reliability, function or design. Nordic Semiconductor ASA does not assume any liability arising out of the application or use of any product or circuits described herein.

All application information is advisory and does not form part of the specification.

Limiting values

Stress above one or more of the limiting values may cause permanent damage to the device. These are stress ratings only and operation of the device at these or at any other conditions above those given in the specifications are not implied. Exposure to limiting values for extended periods may affect device reliability.

Life support applications

These products are not designed for use in life support appliances, devices, or systems where malfunction of these products can reasonably be expected to result in personal injury. Nordic Semiconductor ASA cus-tomers using or selling these products for use in such applications do so at their own risk and agree to fully indemnify Nordic Semiconductor ASA for any damages resulting from such improper use or sale.Contact details

Visit www.nordicsemi.no for Nordic Semiconductor sales offices and distributors worldwide

Main office:

Otto Nielsens vei 127004 Trondheim

Phone: +47 72 89 89 00 Fax: +47 72 89 89 89www.nordicsemi.no

Data sheet status

Objective product specification

This product specification contains target specifications for product development.

Preliminary product specification This product specification contains preliminary data; supplementary

data may be published from Nordic Semiconductor ASA later.

Product specification This product specification contains final product specifications. Nordic

Semiconductor ASA reserves the right to make changes at any time without notice in order to improve design and supply the best possible

product.

nRF24L01+ Preliminary Product Specification Writing Conventions

This product specification follows a set of typographic rules that makes the document consistent and easy to read. The following writing conventions are used:?Commands, bit state conditions, and register names are written in Courier .?Pin names and pin signal conditions are written in Courier bold .?

Cross references are underlined and highlighted in blue .

Revision History

Attention!

Date

Version Description

March 2008 1.0

Observe precaution for handling Electrostatic Sensitive Device.

nRF24L01+ Preliminary Product Specification Contents

1Introduction (7)

1.1Features (8)

1.2Block diagram (9)

2Pin Information (10)

2.1Pin assignment (10)

2.2Pin functions (11)

3Absolute maximum ratings (12)

4Operating conditions (13)

5Electrical specifications (14)

5.1Power consumption (14)

5.2General RF conditions (15)

5.3Transmitter operation (15)

5.4Receiver operation (16)

5.5Crystal specifications (19)

5.6DC characteristics (19)

5.7Power on reset (19)

6Radio Control (20)

6.1Operational Modes (20)

6.1.1State diagram (20)

6.1.2Power Down Mode (21)

6.1.3Standby Modes (21)

6.1.4RX mode (22)

6.1.5TX mode (22)

6.1.6Operational modes configuration (23)

6.1.7Timing Information (23)

6.2Air data rate (24)

6.3RF channel frequency (24)

6.4Received Power Detector measurements (24)

6.5PA control (25)

6.6RX/TX control (25)

7Enhanced ShockBurst? (26)

7.1Features (26)

7.2Enhanced ShockBurst? overview (26)

7.3Enhanced Shockburst? packet format (27)

7.3.1Preamble (27)

7.3.2Address (27)

7.3.3Packet Control Field (27)

7.3.4Payload (28)

7.3.5CRC (Cyclic Redundancy Check) (28)

7.4Automatic packet handling (28)

7.4.1Static and Dynamic Payload Length (29)

7.4.2Automatic packet assembly (29)

7.4.3Automatic packet validation (30)

7.4.4Automatic packet disassembly (30)

nRF24L01+ Preliminary Product Specification

7.5Automatic packet transaction handling (31)

7.5.1Auto Acknowledgement (31)

7.5.2Auto Retransmission (ART) (31)

7.6Enhanced ShockBurst flowcharts (33)

7.6.1PTX operation (33)

7.6.2PRX operation (35)

7.7MultiCeiver? (37)

7.8Enhanced ShockBurst? timing (40)

7.9Enhanced ShockBurst? transaction diagram (42)

7.9.1Single transaction with ACK packet and interrupts (42)

7.9.2Single transaction with a lost packet (43)

7.9.3Single transaction with a lost ACK packet (43)

7.9.4Single transaction with ACK payload packet (44)

7.9.5Single transaction with ACK payload packet and lost packet (44)

7.9.6Two transactions with ACK payload packet and the first

ACK packet lost (45)

7.9.7Two transactions where max retransmissions is reached (45)

7.10Compatibility with ShockBurst? (46)

7.10.1ShockBurst? packet format (46)

8Data and Control Interface (47)

8.1Features (47)

8.2Functional description (47)

8.3SPI operation (47)

8.3.1SPI Commands (47)

8.3.2SPI timing (49)

8.4Data FIFO (52)

8.5Interrupt (53)

9Register Map (54)

9.1Register map table (54)

10Peripheral RF Information (61)

10.1Antenna output (61)

10.2Crystal oscillator (61)

10.3nRF24L01+ crystal sharing with an MCU (61)

10.3.1Crystal parameters (61)

10.3.2Input crystal amplitude and current consumption (61)

10.4PCB layout and decoupling guidelines (62)

11Application example (63)

11.1PCB layout examples (64)

12Mechanical specifications (68)

13Ordering information (70)

13.1Package marking (70)

13.2Abbreviations (70)

13.3Product options (70)

13.3.1RF silicon (70)

13.3.2Development tools (70)

14Glossary of Terms (71)

nRF24L01+ Preliminary Product Specification Appendix A - Enhanced ShockBurst? - Configuration and Communication Example (72)

Enhanced ShockBurst? Transmitting Payload (72)

Enhanced ShockBurst? Receive Payload (73)

Appendix B - Configuration for compatibility with nRF24XX (74)

Appendix C - Constant carrier wave output for testing (75)

Configuration (75)

nRF24L01+ Preliminary Product Specification

1 Introduction

The nRF24L01+ is a single chip 2.4GHz transceiver with an embedded baseband protocol engine (Enhanced ShockBurst?), suitable for ultra low power wireless applications. The nRF24L01+ is designed for operation in the world wide ISM frequency band at 2.400 - 2.4835GHz.

To design a radio system with the nRF24L01+, you simply need an MCU (microcontroller) and a few exter-nal passive components.

You can operate and configure the nRF24L01+ through a Serial Peripheral Interface (SPI). The register map, which is accessible through the SPI, contains all configuration registers in the nRF24L01+ and is accessible in all operation modes of the chip.

The embedded baseband protocol engine (Enhanced ShockBurst?) is based on packet communication and supports various modes from manual operation to advanced autonomous protocol operation. Internal FIFOs ensure a smooth data flow between the radio front end and the system’s MCU. Enhanced Shock-Burst? reduces system cost by handling all the high speed link layer operations.

The radio front end uses GFSK modulation. It has user configurable parameters like frequency channel, output power and air data rate. nRF24L01+ supports an air data rate of 250 kbps, 1 Mbps and 2Mbps. The high air data rate combined with two power saving modes make the nRF24L01+ very suitable for ultra low power designs.

nRF24L01+ is drop-in compatible with nRF24L01 and on-air compatible with nRF2401A, nRF2402,

nRF24E1 and nRF24E2. Intermodulation and wideband blocking values in nRF24L01+ are much improved in comparison to the nRF24L01 and the addition of internal filtering to nRF24L01+ has improved the margins for meeting RF regulatory standards.

Internal voltage regulators ensure a high Power Supply Rejection Ratio (PSRR) and a wide power supply range.

nRF24L01+ Preliminary Product Specification 1.1 Features

Features of the nRF24L01+ include:

?Radio

X Worldwide 2.4GHz ISM band operation

X126 RF channels

X Common RX and TX interface

X GFSK modulation

X250kbps, 1 and 2Mbps air data rate

X1MHz non-overlapping channel spacing at 1Mbps

X2MHz non-overlapping channel spacing at 2Mbps

?Transmitter

X Programmable output power: 0, -6, -12 or -18dBm

X11.3mA at 0dBm output power

?Receiver

X Fast AGC for improved dynamic range

X Integrated channel filters

X13.5mA at 2Mbps

X-82dBm sensitivity at 2Mbps

X-85dBm sensitivity at 1Mbps

X-94dBm sensitivity at 250kbps

?RF Synthesizer

X Fully integrated synthesizer

X No external loop filer, VCO varactor diode or resonator

X Accepts low cost ±60ppm 16MHz crystal

?Enhanced ShockBurst?

X1 to 32 bytes dynamic payload length

X Automatic packet handling

X Auto packet transaction handling

X6 data pipe MultiCeiver? for 1:6 star networks

?Power Management

X Integrated voltage regulator

X1.9 to 3.6V supply range

X Idle modes with fast start-up times for advanced power management

X26μA Standby-I mode, 900nA power down mode

X Max 1.5ms start-up from power down mode

X Max 130us start-up from standby-I mode

?Host Interface

X4-pin hardware SPI

X Max 10Mbps

X3 separate 32 bytes TX and RX FIFOs

X5V tolerant inputs

?Compact 20-pin 4x4mm QFN package

nRF24L01+ Preliminary Product Specification

1.2 Block diagram Array

Figure 1. nRF24L01+ block diagram

nRF24L01+ Preliminary Product Specification 2 Pin Information

2.1 Pin assignment Array

Figure 2. nRF24L01+ pin assignment (top view) for the QFN20 4x4 package

nRF24L01+ Preliminary Product Specification 2.2 Pin functions

Table 1. nRF24L01+ pin function

Pin Name Pin function Description

1CE Digital Input Chip Enable Activates RX or TX mode 2CSN Digital Input SPI Chip Select 3 SCK Digital Input SPI Clock

4MOSI Digital Input SPI Slave Data Input

5 MISO Digital Output SPI Slave Data Output, with tri-state option 6IRQ Digital Output Maskable interrupt pin. Active low 7 VDD Power Power Supply (+1.9V - +3.6V DC)8VSS Power

Ground (0V)9XC2Analog Output Crystal Pin 210XC1Analog Input Crystal Pin 1

11

VDD_PA

Power Output

Power Supply Output (+1.8V) for the internal nRF24L01+ Power Amplifier. Must be con-nected to ANT1 and ANT2 as shown in Fig-ure 29.

12ANT1RF Antenna interface 113ANT2RF Antenna interface 214VSS Power Ground (0V)

15VDD Power

Power Supply (+1.9V - +3.6V DC)

16IREF Analog Input Reference current. Connect a 22k Ω resistor to ground. See Figure 29.17VSS Power Ground (0V)

18VDD Power

Power Supply (+1.9V - +3.6V DC)

19DVDD Power Output Internal digital supply output for de-coupling purposes. See Figure 29. 20

VSS

Power

Ground (0V)

nRF24L01+ Preliminary Product Specification

3 Absolute maximum ratings

Note: Exceeding one or more of the limiting values may cause permanent damage to nRF24L01+. Table 2. Absolute maximum ratings

Operating conditions

Minimum Maximum

Units Supply voltages VDD -0.3

3.6V VSS

0V Input voltage V I

-0.3 5.25V

Output voltage V O

VSS to VDD

VSS to VDD

Total Power Dissipation P D (T A =85°C)60

mW Temperatures

Operating Temperature -40+85°C Storage Temperature

-40

+125

°C

nRF24L01+ Preliminary Product Specification 4 Operating conditions

Table 3. Operating conditions

Symbol Parameter (condition)Notes

Min.Typ.Max.Units VDD Supply voltage

1.9 3.0 3.6V VDD Supply voltage if input signals >3.6V

2.7

3.0 3.3V TEMP Operating Temperature

-40

+27

+85oC

nRF24L01+ Preliminary Product Specification

5 Electrical specifications

Conditions: VDD = +3V, VSS = 0V, T A = - 40oC to + 85oC

5.1 Power consumption

Table 4. Power consumption

Symbol Parameter (condition)Notes

Min.Typ.Max.Units Idle modes

I VDD_PD Supply current in power down

900

nA I VDD_ST1Supply current in standby-I mode

a a.This current is for a 12pF crystal. Current when using external clock is dependent on signal swing.26μA I VDD_ST2Supply current in standby-II mode 320μA I VDD_SU Average current during 1.5ms crystal oscillator startup 400

μA

Transmit

I VDD_TX0Supply current @ 0dBm output power

b b.Antenna load impedance = 15Ω+j88Ω..

11.3mA I VDD_TX6Supply current @ -6dBm output

power

b 9.0mA I VDD_TX12Supply current @ -12dBm output

power

b 7.5mA I VDD_TX18Supply current @ -18dBm output

power

b 7.0mA I VDD_AVG Average Supply current @ -6dBm out-put power, ShockBurst?

c c.Antenna loa

d impedanc

e = 15Ω+j88Ω. Average data rate 10kbps and max. payload length packets.0.12mA I VDD_TXS Average current during TX settling

d d.

Average current consumption during TX startup (130μs) and when changing mode from RX to TX (130μs).

8.0mA Receive

I VDD_2M Supply current 2Mbps 13.5mA I VDD_1M Supply current 1Mbps 13.1mA I VDD_250Supply current 250kbps

12.6mA I VDD_RXS

Average current during RX settling

e e.Average current consumption during RX startup (130μs) and when changing mode from TX to RX (130μs).

8.9

mA

nRF24L01+ Preliminary Product Specification 5.2 General RF conditions

Table 5. General RF conditions

5.3 Transmitter operation

Table 6. Transmitter operation

Symbol Parameter (condition)Notes

Min.Typ.Max.Units f OP Operating frequency

a a.Regulatory standards determine the band range you can use.

2400

2525

MHz PLL res PLL Programming resolution 1MHz f XTAL Crystal frequency

16MHz Δf 250Frequency deviation @ 250kbps ±160kHz Δf 1M Frequency deviation @ 1Mbps ±160kHz Δf 2M Frequency deviation @ 2Mbps

±320

kHz R GFSK

Air Data rate

b b.Data rate in each burst on-air

250

2000

kbps F CHANNEL 1M Non-overlapping channel spacing @ 250kbps/

1Mbps

c c.The minimum channel spacing is 1MHz

1MHz F CHANNEL 2M Non-overlapping channel spacing @ 2Mbps

c 2

MHz

Symbol Parameter (condition)Notes Min.

Typ.Max.Units P RF Maximum Output Power

a a.Antenna load impedance = 15Ω+j88Ω

0+4dBm P RFC RF Power Control Range 161820dB P RFCR RF Power Accuracy

±4dB P BW220dB Bandwidth for Modulated Carrier (2Mbps)18002000kHz P BW120dB Bandwidth for Modulated Carrier (1Mbps)9001000kHz P BW25020dB Bandwidth for Modulated Carrier (250kbps)700

800kHz P RF1.21st Adjacent Channel Transmit Power 2MHz (2Mbps)

-20dBc P RF2.22nd Adjacent Channel Transmit Power 4MHz (2Mbps)

-50dBc P RF1.11st Adjacent Channel Transmit Power 1MHz (1Mbps)

-20dBc P RF2.12nd Adjacent Channel Transmit Power 2MHz (1Mbps)

-45dBc P RF1.2501st Adjacent Channel Transmit Power 1MHz (250kbps)

-30dBc P RF2.250

2nd Adjacent Channel Transmit Power 2MHz (250kbps)

-45

dBc

nRF24L01+ Preliminary Product Specification

5.4 Receiver operation

Table 7. RX Sensitivity

Table 8. RX selectivity according to ETSI EN 300 440-1 V1.3.1 (2001-09) page 27

Datarate Symbol Parameter (condition)Notes Min.

Typ.Max.Units RX max Maximum received signal at <0.1% BER 0dBm 2Mbps RX SENS Sensitivity (0.1%BER) @2Mbps -82dBm 1Mbps RX SENS Sensitivity (0.1%BER) @1Mbps -85dBm 250kbps

RX SENS

Sensitivity (0.1%BER) @250kbps

-94dBm

Datarate Symbol Parameter (condition)Notes Min.Typ.Max.Units 2Mbps C/I CO C/I Co-channel

7dBc C/I 1ST 1st ACS (Adjacent Channel Selectivity) C/I 2MHz 3dBc C/I 2ND 2nd ACS C/I 4MHz -17dBc C/I 3RD 3rd ACS C/I 6MHz

-21dBc C/I Nth N th ACS C/I, f i

> 12MHz

-40dBc C/I Nth N th ACS C/I, f i

> 36MHz

a

a.Narrow Band (In Band) Blocking measurements: 0 to ±40MHz; 1MHz step size

For Interferer frequency offsets n*2*fxtal, blocking performance is degraded by approximately 5dB com-pared to adjacent figures.

-48dBc 1Mbps

C/I CO C/I Co-channel 9dBc C/I 1ST 1st ACS C/I 1MHz 8dBc C/I 2ND 2nd ACS C/I 2MHz -20dBc C/I 3RD 3rd ACS C/I 3MHz -30dBc C/I Nth N th ACS C/I, f i

> 6MHz

-40

dBc C/I Nth N th ACS C/I, f i

> 25MHz

a

-47dBc 250kbps C/I CO C/I Co-channel

12dBc C/I 1ST 1st ACS C/I 1MHz -12dBc C/I 2ND 2nd ACS C/I 2MHz -33dBc C/I 3RD 3rd ACS C/I 3MHz -38dBc C/I Nth N th ACS C/I, f i

> 6MHz

-50

dBc C/I Nth N th ACS C/I, f i

> 25MHz

a

-60

dBc

nRF24L01+ Preliminary Product Specification

Table 9. RX selectivity with nRF24L01+ equal modulation on interfering signal. Measured using

Pin = -67dBm for wanted signal.

Datarate Symbol Parameter (condition)

Notes Min.

Typ.Max.

Units 2Mbps

C/I CO C/I Co-channel (Modulated carrier)11dBc C/I 1ST 1st ACS C/I 2MHz 4dBc C/I 2ND 2nd ACS C/I 4MHz -18dBc C/I 3RD 3rd ACS C/I 6MHz

-24dBc C/I Nth N th ACS C/I, f i > 12MHz -40dBc C/I Nth

N th ACS C/I, f i > 36MHz a

-48dBc 1Mbps

C/I CO C/I Co-channel 12dBc C/I 1ST 1st ACS C/I 1MHz 8dBc C/I 2ND 2nd ACS C/I 2MHz -21dBc C/I 3RD 3rd ACS C/I 3MHz -30dBc C/I Nth N th ACS C/I, f i > 6MHz -40dBc C/I Nth

N th ACS C/I, f i > 25MHz a -50dBc 250kbps

C/I CO C/I Co-channel 7dBc C/I 1ST 1st ACS C/I 1MHz -12dBc C/I 2ND 2nd ACS C/I 2MHz -34dBc C/I 3RD 3rd ACS C/I 3MHz -39dBc C/I Nth N th ACS C/I, f i >6MHz -50dBc C/I Nth

N th ACS C/I, f i >25MHz

a -60

dBc

a.Narrow Band (In Band) Blocking measurements: 0 to ±40MHz; 1MHz step size

Wide Band Blocking measurements: 30MHz to 2000MHz; 10MHz step size 2000MHz to 2399MHz; 3MHz step size 2484MHz to 3000MHz; 3MHz step size 3GHz to 12.75GHz; 25MHz step size

Wanted signal for wideband blocking measurements: -67dBm in 1Mbps and 2Mbps mode -77dBm in 250kbps mode

For Interferer frequency offsets n*2*fxtal, blocking performance are degraded by approximately 5dB compared to adjacent figures.

If the wanted signal is 3dB or more above the sensitivity level then, the carrier/interferer ratio is indepen-dent of the wanted signal level for a given frequency offset.

nRF24L01+ Preliminary Product Specification

Note: Wanted signal level at Pin = -64 dBm. Two interferers with equal input power are used. The

interferer closest in frequency is unmodulated, the other interferer is modulated equal with the wanted signal. The input power of interferers where the sensitivity equals BER = 0.1% is pre-sented. Table 10. RX intermodulation test performed according to Bluetooth Specification version 2.0

Datarate Symbol Parameter (condition)Notes Min.Typ.Max.Units 2Mbps P_IM(6Input power of IM interferers at 6 and 12MHz offset from wanted signal

-42dBm

P_IM(8)Input power of IM interferers at 8 and 16MHz offset from wanted signal

-38dBm

P_IM(10)Input power of IM interferers at 10 and 20MHz offset from wanted signal

-37dBm

1Mbps P_IM(3)Input power of IM interferers at 3 and 6MHz offset from wanted signal

-36dBm

P_IM(4)Input power of IM interferers at 4 and 8MHz offset from wanted signal

-36dBm

P_IM(5)Input power of IM interferers at 5 and 10MHz offset from wanted signal

-36dBm

250kbps P_IM(3)Input power of IM interferers at 3 and 6MHz offset from wanted signal

-36dBm

P_IM(4)Input power of IM interferers at 4 and 8MHz offset from wanted signal

-36dBm

P_IM(5)Input power of IM interferers at 5 and 10MHz offset from wanted signal

-36dBm

nRF24L01+ Preliminary Product Specification 5.5 Crystal specifications

Table 11. Crystal specifications

5.6 DC characteristics

Table 12. Digital input pin

Table 13. Digital output pin

5.7 Power on reset

Table 14. Power on reset

Symbol Parameter (condition)

Notes

Min.

Typ.Max.Units Fxo Crystal Frequency 16MHz ΔF Tolerance

a b

a. Frequency accuracy including; tolerance at 25oC , temperature drift, aging and crystal loading.

b. Frequency regulations in certain regions set tighter requirements for frequency tolerance (For example, Japan and South Korea specify max. +/- 50ppm)

±60ppm C 0Equivalent parallel capacitance 1.57.0pF C L Load capacitance

8

12

16pF ESR

Equivalent Series Resistance

100

Ω

Symbol Parameter (condition)

Notes

Min.Typ.

Max.

Units V IH HIGH level input voltage 0.7VDD 5.25a

a.If the input signal >3.6V, the VDD of the nRF24L01+ must be between 2.7V and 3.3V (3.0V±10%)

V V IL

LOW level input voltage

VSS

0.3VDD V Symbol

Parameter (condition)

Notes

Min.Typ.

Max.Units V OH HIGH level output voltage (I OH =-0.25mA)VDD -0.3

VDD V V OL

LOW level output voltage (I OL =0.25mA)

0.3

V

Symbol Parameter (condition)

Notes

Min.Typ.

Max.Units T PUP Power ramp up time a a.From 0V to 1.9V.

100ms T POR

Power on reset

b

b.Measured from when the VDD reaches 1.9V to when the reset finishes.

1

100ms

nRF24L01+ Preliminary Product Specification 6 Radio Control

This chapter describes the nRF24L01+ radio transceiver’s operating modes and the parameters used to control the radio.

The nRF24L01+ has a built-in state machine that controls the transitions between the chip’s operating modes. The state machine takes input from user defined register values and internal signals.

6.1 Operational Modes

You can configure the nRF24L01+ in power down, standby, RX or TX mode. This section describes these modes in detail.

6.1.1 State diagram

The state diagram in Figure 3. shows the operating modes and how they function. There are three types of distinct states highlighted in the state diagram:

?Recommended operating mode: is a recommended state used during normal operation.

?Possible operating mode: is a possible operating state, but is not used during normal operation.

?Transition state: is a time limited state used during start up of the oscillator and settling of the PLL. When the VDD reaches 1.9V or higher nRF24L01+ enters the Power on reset state where it remains in reset until entering the Power Down mode.

NRF24L01无线模块收发程序(实测成功 多图)

NRF24L01无线模块收发程序(实测成功多图) 本模块是NRF24L01无线传输模块,用于无线传输数据,距离不远,一般只是能够满足小距离的传输,目测是4-5m,价格一般是4元左右,可以方便的买到。 51最小系统学习板就可以,当时是用了两块学习板,一块用于发送,一块用于接收。 小车也是比较容易购到的,四个端口控制两个电机,两个控制一个电机,当两个端口高低电平不同时电机就会转动,即为赋值1和0是电机转动,赋值可以用单片机作用,当然这是小车启动部分,前进后退左转右转就是你赋值0和1的顺序问题了。

整体思路是用发射端的按键控制小车,即为按键按下就前进,再按其他按键实现其他功能,本次程序是在用NRF24L01发射数据在接收端用1602显示的基础上改变。 下面是程序源码(有好几个文件,分别创建) ////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////// #include #include #include'1602.h' #include'delay.h' #include 'nrf24l01.h' #define uint unsigned int #define uchar unsigned char uint Weight_Shiwu=1234; unsigned char KeyScan(void);//键盘扫描 // unsigned char KeyScan(void);//键盘扫描 //#define KeyPort P0 sbit KEY1 = P0^0; sbit KEY2 = P0^1; sbit KEY3 = P0^2; sbit KEY4 = P0^3; sbit KEY5 = P0^4; void main() { // char TxDate[4]; // LCD_Init(); //初始化液晶屏 // LCD_Clear(); //清屏

NRF24L01无线模块收发程序例程

//下面是接收的NRF24L01的程序。 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #include #include "nrf24l01.h" #include #define uchar unsigned char #define uint unsigned int sbit IRQ =P1^2;//输入 sbit MISO =P1^3; //输入 sbit MOSI =P1^1;//输出 sbit SCLK =P1^4;//输出 sbit CE =P1^5;//输出 sbit CSN =P1^0;//输出 uchar RevTempDate[5];//最后一位用来存放结束标志 uchar code TxAddr[]={0x34,0x43,0x10,0x10,0x01};//发送地址 /*****************状态标志*****************************************/ uchar bdata sta; //状态标志 sbit RX_DR=sta^6; sbit TX_DS=sta^5; sbit MAX_RT=sta^4; /*****************SPI时序函数******************************************/ uchar NRFSPI(uchar date) { uchar i; for(i=0;i<8;i++) // 循环8次 { if(date&0x80) MOSI=1; else MOSI=0; // byte最高位输出到MOSI date<<=1; // 低一位移位到最高位 SCLK=1; if(MISO) // 拉高SCK,nRF24L01从MOSI读入1位数据,同时从MISO输出1位数据date|=0x01; // 读MISO到byte最低位 SCLK=0; // SCK置低 } return(date); // 返回读出的一字节 } /**********************NRF24L01初始化函数*******************************/ void NRF24L01Int() {

nRF24L01无线通信模块使用手册

nRF24L01无线通信模块使用手册 一、模块简介 该射频模块集成了NORDIC公司生产的无线射频芯片nRF24L01: 1.支持2.4GHz的全球开放ISM频段,最大发射功率为0dBm 2.2Mbps,传输速率高 3.功耗低,等待模式时电流消耗仅22uA 4.多频点(125个),满足多点通信及跳频通信需求 5.在空旷场地,有效通信距离:25m(外置天线)、10m(PCB天线) 6.工作原理简介: 发射数据时,首先将nRF24L01配置为发射模式,接着把地址TX_ADDR和数据TX_PLD按照时序由SPI 口写入nRF24L01缓存区,TX_PLD必须在CSN为低时连续写入,而TX_ADDR在发射时写入一次即可,然后CE置为高电平并保持至少10μs,延迟130μs后发射数据;若自动应答开启,那么nRF24L01在发射数据后立即进入接收模式,接收应答信号。如果收到应答,则认为此次通信成功,TX_DS置高,同时TX_PLD 从发送堆栈中清除;若未收到应答,则自动重新发射该数据(自动重发已开启),若重发次数(ARC_CNT)达到上限,MAX_RT置高,TX_PLD不会被清除;MAX_RT或TX_DS置高时,使IRQ变低,以便通知MCU。最后发射成功时,若CE为低,则nRF24L01进入待机模式1;若发送堆栈中有数据且CE为高,则进入下一次发射;若发送堆栈中无数据且CE为高,则进入待机模式2。 接收数据时,首先将nRF24L01配置为接收模式,接着延迟130μs进入接收状态等待数据的到来。当接收方检测到有效的地址和CRC时,就将数据包存储在接收堆栈中,同时中断标志位RX_DR置高,IRQ 变低,以便通知MCU去取数据。若此时自动应答开启,接收方则同时进入发射状态回传应答信号。最后接收成功时,若CE变低,则nRF24L01进入空闲模式1。 二、模块电气特性 参数数值单位 供电电压5V 最大发射功率0dBm 最大数据传输率2Mbps 电流消耗(发射模式,0dBm)11.3mA 电流消耗(接收模式,2Mbps)12.3mA 电流消耗(掉电模式)900nA 温度范围-40~+85℃ 三、模块引脚说明 管脚符号功能方向 1GND电源地 2IRQ中断输出O 3MISO SPI输出O 4MOSI SPI输入I 5SCK SPI时钟I 6NC空 7NC空 8CSN芯片片选信号I 9CE工作模式选择I 10+5V电源

nrf24l01无线模块NRF24L01模块收发c程序

//许多人都在找nrf24l01无线模块的c程序;我以前刚接触无线//时用的就是nrf24l01模块;搜索了许多程序有很多都没法直接用;甚至还怀疑模块是不是被我搞坏了;拿去让别人检测模块又是好的;为避免大家走弯路;我将我的程序发出来供大家参考; 这是nrf24l01无线模块pcb图; 下面有Nrf24l01无线模块的收发c程序;以下程序经本人亲自测试;绝对能用!! 请注意以下几点: 1、24L01模块的电源电压是否为3V-3.6V之间; 2、如果您用的单片机是5V的话,请在IO口与模块接口之间串一个1K电阻; 3、检查模块的GND是否与单片机的GND相连接 4、先用程序进行调试,如果IO口不同,请更改IO口或相关时序; 5、如果是51系列单片机,晶振请选用11.0592M Hz; 模块供电最好用asm1117 5v转3.3v 稳压 测试单片机是stc89c52;at89c52 通用; 收发一体;

一大截不废话了;上程序;此程序是按键控制led;当按下s的时候对应接受的led会闪闪发光;很简单的~如果要实现其他更先进的功能;自己发掘吧~~ 务必将硬件连接正确;否则;它不会工作的~~当然做什么都要严谨~~错一点就差大了~~ 《《收发一体程序》》 #include #include typedef unsigned char uchar; typedef unsigned char uint; //****************************************NRF24L01端口定义

*************************************** sbit M ISO =P1^3; sbit M OSI =P1^4; sbit SCK =P1^2; sbit CE =P1^1; sbit CSN =P3^2; sbit IRQ =P3^3; //************************************按键*************************************************** sbit KEY=P2^0; //***************************************************************************** sbit led=P2^1; //*********************************************NRF24L01*********************** ************** #define TX_ADR_WIDTH 5 // 5 uints TX address width #define RX_ADR_WIDTH 5 // 5 uints RX address width #define TX_PLOAD_WIDTH 20 // 20 uints TX payload #define RX_PLOAD_WIDTH 20 // 20 uints TX payload uint const TX_ADDRESS[TX_ADR_WIDTH]= {0x34,0x43,0x10,0x10,0x01}; //本地地址uint const RX_ADDRESS[RX_ADR_WIDTH]= {0x34,0x43,0x10,0x10,0x01}; //接收地址//***************************************NRF24L01寄存器指令******************************************************* #define READ_REG 0x00 // 读寄存器指令 #define WRITE_REG 0x20 // 写寄存器指令 #define RD_RX_PLOAD 0x61 // 读取接收数据指令 #define WR_TX_PLOAD 0xA0 // 写待发数据指令 #define FLUSH_TX 0xE1 // 冲洗发送FIFO指令 #define FLUSH_RX 0xE2 // 冲洗接收FIFO指令 #define REUSE_TX_PL 0xE3 // 定义重复装载数据指令 #define NOP 0xFF // 保留 //*************************************SPI(nRF24L01)寄存器地址**************************************************** #define CONFIG 0x00 // 配置收发状态,CRC校验模式以及收发状态响应方式#define EN_AA 0x01 // 自动应答功能设置 #define EN_RXADDR 0x02 // 可用信道设置 #define SETUP_AW 0x03 // 收发地址宽度设置 #define SETUP_RETR 0x04 // 自动重发功能设置 #define RF_CH 0x05 // 工作频率设置 #define RF_SETUP 0x06 // 发射速率、功耗功能设置 #define STATUS 0x07 // 状态寄存器 #define OBSERVE_TX 0x08 // 发送监测功能 #define CD 0x09 // 地址检测 #define RX_ADDR_P0 0x0A // 频道0接收数据地址 #define RX_ADDR_P1 0x0B // 频道1接收数据地址

nRF24L01_datasheet

PRELIMINARY PRODUCT SPECIFICATION
Single chip 2.4 GHz Transceiver
FEATURES
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? True single chip GFSK transceiver Complete OSI Link Layer in hardware Enhanced ShockBurst? Auto ACK & retransmit Address and CRC computation On the air data rate 1 or 2Mbps Digital interface (SPI) speed 0-8 Mbps 125 RF channel operation Short switching time enable frequency hopping Fully RF compatible with nRF24XX 5V tolerant signal input pads 20-pin package (QFN20 4x4mm) Uses ultra low cost +/- 60 ppm crystal Uses low cost chip inductors and 2-layer PCB Power supply range: 1.9 to 3.6 V
nRF24L01
Wireless mouse, keyboard, joystick Keyless entry Wireless data communication Alarm and security systems Home automation Surveillance Automotive Telemetry Intelligent sports equipment Industrial sensors Toys
APPLICATIONS
? ? ? ? ? ? ? ? ? ? ?
GENERAL DESCRIPTION
nRF24L01 is a single chip radio transceiver for the world wide 2.4 - 2.5 GHz ISM band. The transceiver consists of a fully integrated frequency synthesizer, a power amplifier, a crystal oscillator, a demodulator, modulator and Enhanced ShockBurst? protocol engine. Output power, frequency channels, and protocol setup are easily programmable through a SPI interface. Current consumption is very low, only 9.0mA at an output power of -6dBm and 12.3mA in RX mode. Built-in Power Down and Standby modes makes power saving easily realizable.
QUICK REFERENCE DATA
Parameter
Minimum supply voltage Maximum output power Maximum data rate Supply current in TX mode @ 0dBm output power Supply current in RX mode @ 2000 kbps Temperature range Sensitivity @ 1000 kbps Supply current in Power Down mode
Value
1.9 0 2000 11.3 12.3 -40 to +85 -85 900
Unit
V dBm kbps mA mA °C dBm nA
Table 1 nRF24L01 quick reference data
Nordic Semiconductor ASA Revision: 1.2
- Vestre Rosten 81, N-7075 Tiller, Norway
-
Phone +4772898900
-
Page 1 of 39
Fax +4772898989 March 2006

NRF24L01_学习笔记解读

按照如下方式在电路板上安排的管脚 8 7 6 5 4 3 2 1 各管脚如下定义: 8.IRQ 7.MISO 6.MOSI 5.SCK 4.CSN 3.CE 2.VCC 1.GND 具体说明: 3.CE 芯片的模式控制线。在CSN 为低的情况下,CE 协同NRF24L01 的CONFIG 寄存器共同决定NRF24L01 的状态(参照NRF24L01 的状态机)。 4.CSN 为芯片的片选线CSN 为低电平芯片工作 5.SCK 为芯片控制的时钟线(SPI时钟) 6.MOSI 为芯片控制数据线(Master output slave input)主输出从输入 7.MISO 芯片控制数据线(Master input slave output)master 硕士主人船长slave 从属奴隶 主输入从输出 8.IRQ 中断信号引脚。中断时变为低电平,即NRF24L01内部发生中断时IRQ 引脚从高电平变为低电平。引脚会在以下三种情况变低:Tx FIFO 发完并且收到ACK(使能ACK情况下)、Rx FIFO 收到数据、达到最大重发次数。 中断: nRF24L01 的中断引脚(IRQ)为低电平触发,当状态寄存器中TX_DS(数据发送完成中断位)、RX_DR(接收数据中断位)或MAX_RT(达到最多次重发中断位)为高时触发中断。当MCU 给中断源写‘1’时,中断引脚被禁止。可屏蔽中断可以被IRQ 中断屏蔽。通过设置可屏蔽中断位为高,则中断响应被禁止。默认状态下所有的中断源是被禁止的。 在写寄存器之前一定要进入待机模式或掉电模式

NRF24L01有以下工作模式: 其工作模式又CE和寄存器内部PWR_UP、PRIM_RX共同控制,见下表: NRF24L01所处模式 PWR_UP 位状态 PRIM_RX 位状态 CE引脚 电平 FIFO 寄存器状态 接收模式 1 1 1 - 发送模式 1 0 1 数据在TX FIFO 寄 存器中 发送模式 1 0 1→0 停留在发送模式,直至数据发送完 待机模式II 1 0 1 TX FIFO 为空 待机模式I 1 - 0 无数据传输 掉电模式0 - - - PWR_UP和PRIM_RX 在配置寄存器(CONFIG)中设置,配置寄存器如下:配置寄存器:寄存器地址:00名称:CONFIG CON FIG 配置寄存器(配置NRF24L0 1一些工作方式)第7位 第6位 (MASK_RX_ DR) 第5位 (MASK_TX_D S) 第4位 (MASK_MAX_R T) 第3位 (EN_CRC ) 第2位 (CRCO) 第1位 (PWR_UP ) 第0位 (PRIM_RX ) 保留 (未用) (MASK_RX_ DR)可屏蔽 中断RX_RD。 1:IRQ 引脚 不显示 RX_RD 中断 0:RX_RD 中 断产生时 IRQ 引脚电 平为低 (MASK_TX_D S)可屏蔽中 断TX_DS。 1:IRQ 引脚 不显示TX_DS 中断 0:TX_DS 中 断产生时IRQ 引脚电平为 低 (MASK_MAX_ RT)可屏蔽中 断MAX_RT。 1:IRQ 引脚不 显示TX_DS 中 断 0:MAX_RT 中 断产生时IRQ 引脚电平为低 (EN_CRC )CRC使 能。如果 EN_AA 中任意 一位为 高则 EN_CRC 强迫为 高。 (CRCO) CRC模 式。 ‘0’- 8 位 CRC 校 验 ‘1’- 16 位 CRC 校 验 (PWR_UP )NRF24L 01上电 掉电模 式设置 位。1:上 电 0:掉 电 (PRIM_RX )NRF24L01 接收、发射 模式设置 位。 1:接收 模式 0:发 射模式 STATUS 状态寄存器(反应 nrf24l01当前工作的各种状态)第 7 位 第6位 (RX_DR) 第5位(TX_DS)第4位 第3 位 第2 位 第1 位 第0位 保 留 ( 未 用 ) (RX_DR)接 收数据中断 位。当接收到 有效数据后 置1。写 ‘1’清除中 断 (TX_DS)数据发送 完成中断。当数据发送 完成后产生中断。如果 工作在自动应答模式 下,只有当接收到应答 信号后此位置1。写 ‘1’清除中断。 (MAX_RT)达到 最多次重发中断。 写‘1’清除中 断。如果MAX_RT 中断产生则必须 清除后系统才能 进行通讯 (RX_P_NO)即 接收数据通道号 位。000-101:数 据通道号、110: 未使用、111:RX FIFO 寄存器为 空 (TX_FULL) TX FIFO 寄 存器满标志。 1:TX FIFO 寄 存器满。0: TX FIFO 寄存器 未满,有可用空 间。 5.1收发模式 收发模式有Enhanced ShockBurstTM收发模式、ShockBurstTM收

NRF24L01无线发射简易教程

NRF24L01 简易教程

先来看接口电路,使用的IO 口不是唯一的哦,可随意定义接口,当然是在使用IO 口模拟SPI 且IRQ 中断引脚不使用的使用查询方法判断接收状态的情况下了。作为初探我们就是用简单的IO 模拟SPI 的方法了,中断使用查询的方式。那么该教程讲解的接口与单片机的连接如下: 首先您需要了解NRF24L01,请参阅“NRF24L01 芯片中文资料”或者“NRF24L01 芯片英文资料”。 我们的教程是以一个简单的小项目为大家展示NRF24L01 的使用方法与乐趣。我们所写的教程均是以这种方式的呢,让您在学习的时候明白它能做什么,使您学起来不至于枯燥无味。 作为简易的教程,我们只需要知道它是怎么使用的就够了,我们本教程的目的是用NRF24L01 发送数据和接收数据,且接收方会对比发送的数据与接收的数据,若完全相同则控制LED 闪烁一次,并且把接收到的数据通过串口发送到PC 端,通过串口工具查看接收到的数据。 具体的要求如下: 1、具备发送和接收的能力。 2、发送32 个字节的数据,接收方接收到正确数据之后给予提示,通过LED 闪烁灯形 式。 3、把接收到的数据传送到PC 进行查看。 4、发送端每隔大约1.5 秒发送一次数据,永久循环。以上是程序的要求,若您想自行 设计出硬件接口,您也是可以添加一条呢:使用DIY 方 式设计NRF24L01 的接口板,且包含含单片机平台,使用PCB 方式或者万用板方式均可。如果您想让自己学的很扎实,那么推荐您自行做出接口板子呢。当然若您的能力不足,那么我们不推荐自行做板呢,因为这样会增加您学习的难度,反而起到了反效果呢。 我们使用的方式是画PCB 的方式呢,若您自己做了接口板子,那么您可以对比下一呢,O(∩_∩)O! 我们知道NRF24L01 的供电电压是1.9V~3.6V 不能超过这个范围,低了不工作,高了可能烧毁NRF24L01 芯片。我们常用的STC89C52 的单片机的供电电压是5V,我们不能直接给24L01 这个模块供电,我们需要使用AMS1117-3.3V 稳压芯片把5V 转成3.3V 的电压为24L01 模块供电。 为此我们的设计原理图如下:包含单片机最小系统、供电系统、下载程序接口、5V 转3.3V 电路、NRF24L01 模块接口。并且全部引出单片机的IO 口,另外还加了5 个电源输出接口,为扩展使用。还包括了电源指示LED 以及一个IO 口独立控制的LED,这个独立控制的LED用于NRF24L01 接收成功闪烁指示。为了保证系统的稳定性,在设计中添加了两个滤波电容。

nRF24L01温度发送与接收程序

/******************************************************* ** 温度无线发送程序 ** 时间:2012.2.3 ** ——by Keliwen *******************************************************/ #include #include #include #include typedef unsigned char uchar; typedef unsigned int uint; /***************************************************/ #define TX_ADR_WIDTH 5 // 5字节宽度的发送/接收地址 #define TX_PLOAD_WIDTH 4 // 数据通道有效数据宽度 uchar code TX_ADDRESS[TX_ADR_WIDTH] = {0x34,0x43,0x10,0x10,0x01}; // 定义一个静态发送地址 uchar RX_BUF[TX_PLOAD_WIDTH]; uchar TX_BUF[TX_PLOAD_WIDTH]; sbit CSN = P1^0; // Chip Enable pin signal (output) sbit MOSI= P1^1; // Slave Select pin, (output to CSN, nRF24L01) sbit IRQ = P1^2; // Interrupt signal, from nRF24L01 (input) sbit MISO= P1^3; // Master In, Slave Out pin (input) sbit SCLK= P1^4; // Serial Clock pin, (output) sbit CE = P1^5; // Master Out, Slave In pin (output) // SPI(nRF24L01) commands #define READ_REG 0x00 // Define read command to register #define WRITE_REG 0x20 // Define write command to register #define RD_RX_PLOAD 0x61 // Define RX payload register address #define WR_TX_PLOAD 0xA0 // Define TX payload register address #define FLUSH_TX 0xE1 // Define flush TX register command #define FLUSH_RX 0xE2 // Define flush RX register command #define REUSE_TX_PL 0xE3 // Define reuse TX payload register command #define NOP 0xFF // Define No Operation, might be used to read status register // SPI(nRF24L01) registers(addresses) #define CONFIG 0x00 // 'Config' register address #define EN_AA 0x01 // 'Enable Auto Acknowledgment' register address #define EN_RXADDR 0x02 // 'Enabled RX addresses' register address

NRF24L01详细教程..

先来看接口电路,使用的IO 口不是唯一的哦,可随意定义接口,当然是在使用IO 口模拟SPI 且IRQ 中断引脚不使用的使用查询方法判断接收状态的情况下了。作为初探我们就是用简单的IO 模拟SPI 的方法了,中断使用查询的方式。那么该教程讲解的接口与单片机的连接如下: 首先您需要了解NRF24L01,请参阅“NRF24L01 芯片中文资料”或者“NRF24L01 芯片英文资料”。 我们的教程是以一个简单的小项目为大家展示NRF24L01 的使用方法与乐趣。我们所写教程均是以这种方式的呢,让您在学习的时候明白它能做什么,使您学起来不至于枯燥无味。 作为简易的教程,我们只需要知道它是怎么使用的就够了,我们本教程的目的是用NRF24L01 发送数据和接收数据,且接收方会对比发送的数据与接收的数据,若完全相同则控制LED 闪烁一次,并且把接收到的数据通过串口发送到PC 端,通过串口工具查看接收到的数据。 具体的要求如下: 1、具备发送和接收的能力。 2、发送32 个字节的数据,接收方接收到正确数据之后给予提示,通过LED 闪烁灯形 式。 3、把接收到的数据传送到PC 进行查看。 4、发送端每隔大约1.5 秒发送一次数据,永久循环。 以上是程序的要求,若您想自行设计出硬件接口,您也是可以添加一条呢:使用DIY 方式设计NRF24L01 的接口板,且包含含单片机平台,使用PCB 方式或者万用板方式均可。如果您想让自己学的很扎实,那么推荐您自行做出接口板子呢。当然若您的能力不足,那么我们不推荐自行做板呢,因为这样会增加您学习的难度,反而起到了反效果呢。 我们知道NRF24L01 的供电电压是1.9V~3.6V 不能超过这个范围,低了不工作,高了可能烧毁NRF24L01 芯片。我们常用的STC89C52 的单片机的供电电压是5V,我们不能直接给24L01 这个模块供电,我们需要使用AMS1117-3.3V 稳压芯片把5V 转成3.3V 的电压为24L01 模块供电。 为此我们的设计原理图如下:包含单片机最小系统、供电系统、下载程序接口、5V 转3.3V 电路、NRF24L01 模块接口。并且全部引出单片机的IO 口,另外还加了5 个电源输出接口,为扩展使用。还包括了电源指示LED 以及一个IO 口独立控制的LED,这个独立控制的LED用于NRF24L01 接收成功闪烁指示。为了保证系统的稳定性,在设计中添加了两个滤波电容。

NRF24L01 MSP430发送接收程序

NRF24L01 MSP430发送接收程序 作者:codebaby 文章来源:codebaby 点击数: 1351 更新时间:2011-8-18 最近弄了几天的无线模块,玩的是NRF2L01,因为这款 无线模块价格便宜,网上也就卖10多块钱!刚开始用51 写,“百度一下”发现网上的程序真是百篇一律,你抄我, 我抄你。对比了几个程序之后,发现他们的程序注释也是 自相矛盾,看了的唯一收获就是,结合技术资料,对NR F24L01的工作模式和通信过程有了个总体的把握。 用51调了几次没成功,改而用430板子来写。在网上查 了一些相关的程序,终于成功了。现在发现其实要写对N RF24L01的基本通信程序并不难,当然要玩转它又是另外 一回事了。我也刚刚才玩会单通道接收发送这个工作模式,其他的工作模式还没玩!还是附上相应的程序供大家学习交流,当然程序可能难免还有疏漏和错误,还望比拼 指出! 这是NRF24L01的头文件配置程序: #include //=======================NRF24L01_CE 端口========================================= #define RF24L01_CE_0 P3OUT &=~BIT1 #define RF24L01_CE_1 P3OUT |= BIT1 //=============================RF24L01_CSN 端口================================== #define RF24L01_CSN_0 P3OUT &=~BIT3 #define RF24L01_CSN_1 P3OUT |= BIT3 //=============================RF24L01_SCK 端口====================================== #define RF24L01_SCK_0 P3OUT &=~BIT2 #define RF24L01_SCK_1 P3OUT |= BIT2 //=============================RF24L01_MISO 端口========================================= #define RF24L01_MISO_0 P3OUT &=~BIT0 #define RF24L01_MISO_1 P3OUT |= BIT0 //============================= RF24L01_MOSI 端口================================ #define RF24L01_MOSI_0 P2OUT &=~BIT6 #define RF24L01_MOSI_1 P2OUT |= BIT6 //==========================IRQ 状态============================================ #define RF24L01_IRQ_0 P2OUT &=~BIT7

STC12单片机SPI的nrf24l01接收程序

#include #include typedef unsigned char uchar; #define uint unsigned int //****************************************IO端口定义*************************************** sfr SPCTL = 0xCE; //SPI Control Register SSIG SPEN DORD MSTR CPOL CPHA SPR1 SPR0 0000,0100 sfr SPSTAT = 0xCD; //SPI Status Register SPIF WCOL - - - - - - 00xx,xxxx sfr SPDAT = 0xCF; sbit CE =P1^0; sbit CSN =P1^1; sbit IRQ =P1^2; sbit led = P1^3; //****************************************************************************************** uchar bdata sta; //状态标志 sbit RX_DR =sta^6; sbit TX_DS =sta^5; sbit MAX_RT =sta^4; //*********************************************NRF24L01************************************* #define TX_ADR_WIDTH 5 // 5 uints TX address width #define RX_ADR_WIDTH 5 // 5 uints RX address width #define TX_PLOAD_WIDTH 32 // 32 uints TX payload #define RX_PLOAD_WIDTH 32 // 32 uints TX payload uchar const TX_ADDRESS[TX_ADR_WIDTH]= {0x34,0x43,0x10,0x10,0x01}; //本地地址 uchar const RX_ADDRESS[RX_ADR_WIDTH]= {0x34,0x43,0x10,0x10,0x01}; //接收地址 uchar code Tx_Buf[TX_PLOAD_WIDTH]={0xff,0xee,0x11,0x22,0x33,0xaa,0xbb,0x11,0x22,0x33,0xaa,0xbb,0x11,0x2 2, 0x33,0xaa,0xbb,0x11,0x22,0x33,0xaa,0xbb,0x11,0x22,0x33,0xaa,0xbb,0x11,0x22,0x33,0xee,0xff};/ /发送数据 uchar Rx_Buf[RX_PLOAD_WIDTH];//接收数据 //***************************************NRF24L01寄存器指令 ******************************************************* #define READ_REG 0x00 // 读寄存器指令 #define WRITE_REG 0x20 // 写寄存器指令 #define RD_RX_PLOAD 0x61 // 读取接收数据指令 #define WR_TX_PLOAD 0xA0 // 写待发数据指令 #define FLUSH_TX 0xE1 // 冲洗发送 FIFO指令 #define FLUSH_RX 0xE2 // 冲洗接收 FIFO指令 #define REUSE_TX_PL 0xE3 // 定义重复装载数据指令 #define NOP 0xFF // 保留

NRF24L01接收程序(可用)

////************************************接收程序******************************************************// #include #include typedef unsigned char uchar; //****************************************NRF24L01端口定义*************************************** sbit M ISO =P1^5; sbit M OSI =P1^1; sbit SCK =P1^6; sbit CE =P1^7; sbit CSN =P1^2; sbit IRQ =P1^0; //***************************************************************************** ************** #define TX_ADR_WIDTH 5 // 5 uints TX address width #define RX_ADR_WIDTH 5 // 5 uints RX address width #define TX_PLOAD_WIDTH 32 // 20 uints TX payload #define RX_PLOAD_WIDTH 32 // 20 uints TX payload uchar const TX_ADDRESS[TX_ADR_WIDTH]= {0x34,0x43,0x10,0x10,0x01}; //本地地址 uchar const RX_ADDRESS[RX_ADR_WIDTH]= {0x34,0x43,0x10,0x10,0x01}; //接收地址 //***************************************NRF24L01寄存器指令*******************************************************

NRF24L01模块说明书

NRF24L01高速嵌入式无线数传模块 说 明 书

2008年12月20日 一、产品特性 2.4GHz全球开放ISM频段,最大0dBm发射功率,免许可证使用 支持六路通道的数据接收 低工作电压:1.9~3.6V低电压工作 高速率:2Mbps,由于空中传输时间很短,极大的降低了无线传输中的碰撞现象(软件设置1Mbps或者2Mbps的空中传输速率) 多频点:125频点,满足多点通信和跳频通信需要 超小型:内置2.4GHz天线,体积小巧,15x29mm(包括天线) 低功耗:当工作在应答模式通信时,快速的空中传输及启动时间,极大的降低了电流消耗。 低应用成本:NRF24L01集成了所有与RF协议相关的高速信号处理部分,比如:自动重发丢失数据 包和自动产生应答信号等,NRF24L01的SPI接口可以利用单片机的硬件SPI口连接或用单片机I/O口进行模拟,内部有FIFO可以与各种高低速微处理器接口,便于使用低成本单片机。 便于开发:由于链路层完全集成在模块上,非常便于开发。 自动重发功能,自动检测和重发丢失的数据包,重发时间及重发次数可软件控制

自动存储未收到应答信号的数据包 自动应答功能,在收到有效数据后,模块自动发送应答信号,无须另行编程 载波检测—固定频率检测 内置硬件CRC检错和点对多点通信地址控制 数据包传输错误计数器及载波检测功能可用于跳频设置 可同时设置六路接收通道地址,可有选择性的打开接收通道 标准插针Dip2.54MM间距接口,便于嵌入式应用 二、基本电气特性 三、引脚说明

说明: 1)VCC脚接电压范围为1.9V~3.6V之间,不能在这个区间之外,超 过3.6V将会烧毁模块。推荐电压3.3V左右。 (2)除电源VCC和接地端,其余脚都可以直接和普通的5V单片机IO口 直接相连,无需电平转换。当然对3V左右的单片机更加适用了。 (3)硬件上面没有SPI的单片机也可以控制本模块,用普通单片机IO 口模拟SPI不需要单片机真正的串口介入,只需要普通的单片机IO口 就可以了,当然用串口也可以了(a:与51系列单片机P0口连接时候,需要加10K的上 拉电阻,与其余口连接不需要。 b:其他系列的单片机,如果是5V的,请参考该系列 单片机IO口输出电流大小,如果超过10mA,需要串联 电阻分压,否则容易烧毁模块!如果是3.3V的,可以 直接和RF24l01模块的IO口线连接。比如AVR系列单片机

相关文档
最新文档