亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? maintutorial2local.c

?? 介紹NRF24L01的增強型突發模式(Enhanced ShockBurst Mode),此模式有效數據速率為2Mbps。其中文件nrf24l01.c實現增強型突發模式
?? C
字號:
/*****************************************************************************
*
* File: maintutorial1local.c
* 
* Copyright S. Brennen Ball, 2007
* 
* The author provides no guarantees, warantees, or promises, implied or
*	otherwise.  By using this software you agree to indemnify the author
* 	of any damages incurred by using it.
* 
*****************************************************************************/

//This code depends on a clock frequency of 40 MHz (I use a 10 MHz crystal and
//  the PLL.  If you are using a slower clock, then you must change the SPI and
//  UART rates, as well as the delay lengths in delays.c

#include <p18f452.h>
#include <stdio.h>
#include <usart.h>
#include <spi.h>
#include "delays.h"
#include "nrf24l01.h"

void Initialize(void);
void InitializeIO(void);

void ToggleLED(void); //toggle the current state of the on-board LED
void CheckErrorsUSART(void); //fix any framing or overrun errors in the USART

//main routine
void main(void)
{
	unsigned char data; //register to hold letter sent and received
	unsigned int count; //counter for for loop
	
	Initialize(); //initialize PLL, IO, UART, SPI, set up nRF24L01 as TX

	//main program loop
	while(1)
	{
		CheckErrorsUSART();
		  
		//check UART status register to see if data has been received.  if so, process
		while(DataRdyUSART())
		{
			data = ReadUSART(); //get data from UART
			nrf24l01_write_tx_payload(&data, 1, true); //transmit received char over RF

			//wait until the packet has been sent or the maximum number of retries has been active
			while(!(nrf24l01_irq_pin_active() && (nrf24l01_irq_tx_ds_active() || nrf24l01_irq_max_rt_active())));

			//check to see if the maximum number of retries has been hit.  if not, wait for the RX device
			// to send the char back.  if so, assume the packet is lost and send "*" back to UART
			if(!nrf24l01_irq_max_rt_active())
			{
				nrf24l01_irq_clear_all(); //clear all interrupts in the 24L01
				nrf24l01_set_as_rx(true); //change the device to an RX to get the character back from the other 24L01

				//wait a while to see if we get the data back (change the loop maximum and the lower if
				//  argument (should be loop maximum - 1) to lengthen or shorten this time frame
				for(count = 0; count < 20000; count++)
				{
					//check to see if the data has been received.  if so, get the data and exit the loop.
					//  if the loop is at its last count, assume the packet has been lost and set the data
					//  to go to the UART to "?".  If neither of these is true, keep looping.
					if((nrf24l01_irq_pin_active() && nrf24l01_irq_rx_dr_active()))
					{
						nrf24l01_read_rx_payload(&data, 1); //get the payload into data
						break;
					}
					
					//if loop is on its last iteration, assume packet has been lost.
					if(count == 19999)
						data = '?';
				}
				
				nrf24l01_irq_clear_all(); //clear interrupts again
				printf("%c", data); //print the received data (or ? if none) to the screen
			
				DelayUS(130); //wait for receiver to come from standby to RX
				nrf24l01_set_as_tx(); //resume normal operation as a TX
			}
			else
			{
				nrf24l01_flush_tx(); //get the unsent character out of the TX FIFO
				nrf24l01_irq_clear_all(); //clear all interrupts
				printf("*"); //print "*" to the screen to show that the receiver did not receive the packet
			}
									
			ToggleLED(); //toggle the on-board LED as visual indication that the loop has completed
		}
	}
}

//initialize routine
void Initialize(void)
{
	InitializeIO(); //set up IO (directions and functions)
	OpenUSART (USART_TX_INT_OFF & USART_RX_INT_OFF & USART_ASYNCH_MODE & USART_EIGHT_BIT & USART_CONT_RX & USART_BRGH_LOW, 64); //open UART
	OpenSPI(SPI_FOSC_16, MODE_00, SMPMID); //open SPI1
	nrf24l01_initialize_debug(false, 1, true); //initialize the 24L01 to the debug configuration as TX, 1 data byte, and auto-ack enabled
}

//initialize IO pins
void InitializeIO(void)
{
	ADCON1 = 0x7; //disable AD converter functionality on PORTA
	TRISAbits.TRISA0 = 0; //make PORTA.0 an output to control LED
	PORTAbits.RA0 = 1; //turn on LED
	
	TRISBbits.TRISB0 = 1; //make sure that PORTB.0 is input since it is IRQ pin
	
	TRISC = 0x91; //make CSN, CE, SCK, MOSI (SDO), and TX outputs
	PORTC = 0x04; //set CSN bit
}	

//toggles on-board LED
void ToggleLED(void)
{
	PORTAbits.RA0 = ~PORTAbits.RA0;
}	

//fixes any framing or overrun errors that would otherwise halt the USART
void CheckErrorsUSART(void)
{
	unsigned char data; //dummy data variable
	
	//check for overrun error
	if(RCSTAbits.OERR)
	{
		RCSTAbits.CREN = 0; //clearing CREN clears OERR
		RCSTAbits.CREN = 1; //re-establish communications
		data = ReadUSART(); //make a dummy read in case there is data in the USART
	}
	 
	//check for framing error  
	if(RCSTAbits.FERR)
		data = ReadUSART(); //reading the USART clears this error
}		
	

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久亚洲一级片| 国产一区二区三区国产| 精品一区二区在线观看| 91麻豆123| 国产亚洲视频系列| 久久丁香综合五月国产三级网站| 成人国产电影网| www久久精品| 日日摸夜夜添夜夜添亚洲女人| 成人av在线网站| www久久精品| 久久99精品国产91久久来源| 欧美亚洲国产怡红院影院| 欧美国产精品一区二区| 美女被吸乳得到大胸91| 欧美日韩在线播放三区| 亚洲免费在线视频| 成人美女视频在线观看18| 久久亚洲私人国产精品va媚药| 青青草原综合久久大伊人精品 | 日韩国产一二三区| 91一区在线观看| 国产精品盗摄一区二区三区| 久久精品999| 精品国一区二区三区| 捆绑调教美女网站视频一区| 欧美一级在线视频| 蜜桃av一区二区三区| 日韩欧美国产一区二区在线播放| 日韩激情在线观看| 91精品国产一区二区三区香蕉| 亚洲国产精品人人做人人爽| 91黄色免费网站| 亚洲精品国产一区二区精华液 | 欧美日韩国产大片| 亚洲成人免费视频| 欧美精三区欧美精三区| 日韩综合小视频| 日韩一区二区三区视频| 蜜桃久久久久久久| 欧美精品一区二区高清在线观看 | 成人美女在线视频| 亚洲视频图片小说| 色综合久久久久综合体| 亚洲小少妇裸体bbw| 欧美久久一二区| 日本欧美肥老太交大片| 日韩美女主播在线视频一区二区三区| 久久精品噜噜噜成人88aⅴ | 国内久久精品视频| 国产偷国产偷亚洲高清人白洁| 福利视频网站一区二区三区| 18欧美亚洲精品| 在线91免费看| 国产精品中文字幕日韩精品| 国产精品美女视频| 欧美色爱综合网| 国产精品一二三区在线| 国产精品福利av| 欧美日韩电影一区| 懂色av一区二区夜夜嗨| 亚洲黄色av一区| 欧美mv和日韩mv的网站| 99久久精品免费看| 图片区日韩欧美亚洲| 国产日韩成人精品| 在线免费不卡视频| 国产精品亚洲人在线观看| 亚洲欧美国产高清| 日韩亚洲欧美在线| 色婷婷综合久久久久中文一区二区| 五月激情综合婷婷| 国产精品久久久久一区二区三区 | 欧美国产成人精品| 欧美三电影在线| 丰满白嫩尤物一区二区| 午夜成人免费电影| 国产精品久线观看视频| 91精品欧美福利在线观看| 不卡一区二区中文字幕| 美女mm1313爽爽久久久蜜臀| 亚洲欧美偷拍另类a∨色屁股| 日韩视频一区在线观看| 97se狠狠狠综合亚洲狠狠| 麻豆国产91在线播放| 亚洲国产精品一区二区久久恐怖片| 国产午夜精品久久久久久免费视 | 成人一道本在线| 伦理电影国产精品| 午夜精品视频在线观看| 亚洲欧美一区二区在线观看| 精品对白一区国产伦| 欧美日韩在线观看一区二区| 91在线观看污| 国产成人无遮挡在线视频| 青草国产精品久久久久久| 午夜久久久久久久久久一区二区| 亚洲色图20p| 中文字幕一区在线| 国产日韩视频一区二区三区| 日韩三级精品电影久久久| 欧美日韩精品欧美日韩精品一| 91在线观看下载| 99久久国产综合色|国产精品| 国产成人亚洲综合a∨猫咪 | 日韩精品电影一区亚洲| 夜夜夜精品看看| 一区二区久久久| 亚洲精品写真福利| 亚洲欧美二区三区| 一区二区三区日本| 亚洲一区欧美一区| 亚洲国产美女搞黄色| 亚洲国产精品精华液网站| 亚洲久草在线视频| 亚洲精品日韩综合观看成人91| 日韩一区日韩二区| 亚洲三级电影网站| 亚洲精品日韩综合观看成人91| 一区二区三区产品免费精品久久75| 国产精品久久久一本精品| 最新欧美精品一区二区三区| 亚洲精品亚洲人成人网| 亚洲国产精品久久不卡毛片 | 国产99久久久国产精品免费看| 狠狠色狠狠色综合| 国产成人精品www牛牛影视| 成人一区二区三区| 在线区一区二视频| 日韩欧美国产精品一区| 久久一日本道色综合| 亚洲国产精品激情在线观看| 国产精品福利影院| 亚洲成人动漫在线观看| 久久99精品久久久久久久久久久久| 国产美女娇喘av呻吟久久| 99在线精品免费| 欧美日韩精品综合在线| 亚洲精品在线免费播放| 亚洲视频在线一区观看| 亚洲观看高清完整版在线观看| 蜜臀av一区二区在线观看| 国产不卡视频在线播放| 欧美亚洲国产一区二区三区| 精品久久国产老人久久综合| 国产精品美女www爽爽爽| 亚洲一区二区在线播放相泽 | 午夜久久久影院| 国产精品中文字幕日韩精品 | 日韩精品一区二区三区swag| 日本一区二区三区高清不卡| 亚洲精品少妇30p| 激情久久久久久久久久久久久久久久| 成人一区二区在线观看| 91精品视频网| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 五月婷婷久久丁香| 成人动漫av在线| 日韩一区二区三区在线| 亚洲欧美日韩国产中文在线| 免费看日韩精品| 91国在线观看| 国产欧美日本一区二区三区| 石原莉奈在线亚洲三区| 成人av网址在线| 日韩一区二区免费高清| 一区二区日韩av| 99国产精品国产精品毛片| 精品免费日韩av| 五月激情丁香一区二区三区| 91最新地址在线播放| 久久综合狠狠综合| 蜜臀精品一区二区三区在线观看| 色综合久久久网| 中文字幕精品—区二区四季| 久久精品国产亚洲高清剧情介绍 | 五月婷婷久久综合| 在线亚洲+欧美+日本专区| 国产精品女人毛片| 国产一区二区毛片| 精品国产伦一区二区三区免费| 亚洲图片欧美色图| 91女厕偷拍女厕偷拍高清| 国产色产综合色产在线视频| 久久er精品视频| 欧美一区二区三区免费观看视频| 一区二区高清视频在线观看| 91麻豆精品秘密| 亚洲日本丝袜连裤袜办公室| 成人黄色小视频在线观看| 久久综合久久久久88| 久久91精品国产91久久小草| 91精品国产免费| 蜜臀av性久久久久蜜臀aⅴ| 欧美电影一区二区| 日本系列欧美系列| 日韩欧美一级特黄在线播放| 免费在线观看一区二区三区| 在线成人av影院| 久久精品99国产国产精|