新手上路
- 积分
- 36
- 金钱
- 36
- 注册时间
- 2015-2-21
- 在线时间
- 0 小时
|
5金钱
<p>
发送程序:
</p>
<p>
#include "led.h"<br />
#include "delay.h"<br />
#include "key.h"<br />
#include "sys.h"<br />
#include "usart.h" <br />
#include "24l01.h" <br />
#include "spi.h"
</p>
<p>
#include "string.h"<br />
#include "ov7670.h"<br />
#include "tpad.h"<br />
#include "timer.h"<br />
#include "exti.h"<br />
#include "usmart.h"<br />
#include "stm32f10x_exti.h"<br />
extern u8 ov_sta; //??exit.c?????¨??<br />
extern u8 ov_frame; //??timer.c?????¨?? <br />
//ALIENTEK????STM32??·?°????é32<br />
//?????¨?? ???é <br />
//?????§????www.openedv.com<br />
//?????????í??×????????????? <br />
int main(void)<br />
{ <br />
u8 lightmode=0,saturation=2,brightness=2,contrast=2;<br />
u8 effect=0;<br />
u8 t;<br />
u32 j;<br />
u16 color; <br />
u8 tmp_buf[33]; <br />
delay_init(); //???±?????????? <br />
NVIC_Configuration(); //?è??NVIC????·?×é2:2??????????????2???ì????????<br />
uart_init(9600); //?®??????????9600<br />
LED_Init(); //LED??????????<br />
SPI2_Init();<br />
NRF24L01_Init(); //??????NRF24L01 <br />
while(NRF24L01_Check()) //?ì?éNRF24L01??·?????. <br />
{<br />
printf("NRF24L01 Error");<br />
delay_ms(50000);<br />
<br />
} <br />
printf("NRF24L01 OK");<br />
delay_ms(2000);
</p>
<p>
//?????·?????? <br />
while(OV7670_Init());<br />
OV7670_Light_Mode(lightmode);<br />
OV7670_Color_Saturation(saturation);<br />
OV7670_Brightness(brightness);<br />
OV7670_Contrast(contrast);<br />
OV7670_Special_Effects(effect); <br />
TIM6_Int_Init(10000,7199); //10Khz????????,1???????? <br />
EXTI8_Init(); //?????¨?±?÷????<br />
OV7670_Window_Set(10,174,240,320); //?è???°?? <br />
OV7670_CS=0;
</p>
<p>
<br />
NRF24L01_TX_Mode();<br />
tmp_buf[0]=0xf0;<br />
while(1)
</p>
<p>
<br />
</p>
<p>
接受程序:<br />
#include "led.h"<br />
#include "delay.h"<br />
#include "key.h"<br />
#include "sys.h"<br />
#include "lcd.h"<br />
#include "usart.h" <br />
#include "24l01.h" <br />
#include "spi.h"
</p>
<p>
#include "usmart.h"
</p>
<p>
//ALIENTEK????STM32??·?°????é32<br />
//?????¨?? ???é <br />
//?????§????www.openedv.com<br />
//?????????í??×????????????? <br />
int main(void)<br />
{ <br />
<br />
// u8 i=0; <br />
// u8 msgbuf[15];//??????????<br />
// u8 tm=0;<br />
u32 j;<br />
u16 color;
</p>
<p>
<br />
u16 t=0; <br />
u8 tmp_buf[33]; <br />
delay_init(); //???±?????????? <br />
NVIC_Configuration(); //?è??NVIC????·?×é2:2??????????????2???ì????????<br />
uart_init(9600); //?®??????????9600<br />
LED_Init(); //LED??????????<br />
SPI2_Init();<br />
LCD_Init(); <br />
<br />
if(lcddev.id==0X6804||lcddev.id==0X5310) //?????è??????·?±?????320*240.???§??3.5???ó??<br />
{<br />
lcddev.width=240;<br />
lcddev.height=320; <br />
}<br />
usmart_dev.init(72); //??????USMART <br />
<br />
<br />
NRF24L01_Init(); //??????NRF24L01 <br />
<br />
<br />
while(NRF24L01_Check()) //?ì?éNRF24L01??·?????. <br />
{<br />
printf("NRF24L01 Error");<br />
delay_ms(50000); <br />
} <br />
printf("NRF24L01 OK");<br />
delay_ms(2000);<br />
NRF24L01_RX_Mode(); <br />
while(1)<br />
{ <br />
if(tmp_buf[0]==0xf0)//???©??????????,?ò????????.<br />
{<br />
LCD_Scan_Dir(U2D_L2R); //????????,??×ó???? <br />
LCD_SetCursor(0x00,0x0000); //?è????±ê???? <br />
LCD_WriteRAM_Prepare(); //????????GRAM <br />
for(j=0;j<4800;j++)<br />
{ <br />
for(t=0;t<32;t=+2)<br />
{<br />
color=tmp_buf[t]; //??????<br />
color<<=8; <br />
color|=tmp_buf[t+1]; <br />
LCD->LCD_RAM=color; <br />
} <br />
} <br />
<br />
LCD_Scan_Dir(DFT_SCAN_DIR); <br />
// printf ("%d\n",tmp_buf[0]);<br />
// <br />
// LED0=tmp_buf[0];<br />
// <br />
// printf("NRF24L01 OK"); <br />
// delay_ms(2000); <br />
}<br />
<br />
</p>
<p>
<br />
else <br />
delay_us(100); <br />
t++;<br />
if(t==10000)//?ó??1s????±?????×???<br />
{<br />
t=0; <br />
printf("NRF24L01 Error1");<br />
delay_ms(2000);<br />
}
</p>
<p>
}<br />
}
</p>
<p>
<br />
</p>
<p>
串口一直打出来是这种:
</p>
<p>
菜鸟在这里谢谢大家了!!项目急用
</p>
<p>
【2015-03-13 17:24:38:363】NRF24L01 error<br />
【2015-03-13 17:24:38:523】NRF24L01 error<br />
【2015-03-13 17:24:38:683】NRF24L01 error<br />
【2015-03-13 17:24:38:843】NRF24L01 error<br />
【2015-03-13 17:24:39:002】NRF24L01 error<br />
【2015-03-13 17:24:39:158】frame:0fps
</p>
<p>
基础不扎实我就不知道这句什么意思了:<br />
【2015-03-13 17:24:39:158】frame:0fps
</p>
<p>
菜鸟在这里谢谢大家了
</p>
<p>
<br />
</p> |
|