天线|RF射频
直播中

李洁

7年用户 140经验值
私信 关注
[问答]

OV7670+24L01如何实现TFT屏显示?

我想要完成的功能是:两块32板,一块用OV7670采集图像,用24L01发送图像数据;另一块用24L01采集图像,用TFT屏显示出来。



可是结果却是:发送板停在"NRF24L01 OK"不动了。接收板也停在"NRF24L01 OK"也不动了。

我怎么也想不通是哪里出现问题。猜想是无线模块的同步有问题,可是按逻辑应该是没有错误的呀。怎么也不可能出现这样的结果






这是我发送代码


[C] 纯文本查看 复制代码
#include "sys.h"#include "usart.h"#include "delay.h"#include "led.h" #include "beep.h"  #include "key.h"  #include "exti.h"  #include "wdg.h"  #include "timer.h"  #include "tpad.h"#include "oled.h"  #include "lcd.h"#include "usmart.h"#include "rtc.h"  #include "wkup.h"#include "adc.h"  #include "dac.h"  #include "dma.h"  #include "24cxx.h"  #include "flash.h"  #include "rs485.h"  #include "can.h"  #include "touch.h"  #include "remote.h"  #include "joypad.h"#include "adxl345.h"#include "ds18b20.h"#include "dht11.h"#include "24l01.h"#include "mouse.h"#include "stmflash.h"#include "rda5820.h"#include "audiosel.h"#include "ov7670.h"const u8*LMODE_TBL[5]={"Auto","Sunny","Cloudy","Office","Home"};//5种光照模式    const u8*EFFECTS_TBL[7]={"Normal","Negative","B&W","Redish","Greenish","Bluish","Antique"};//7种特效 extern u8 ov_sta;//在exit.c里面定义 //更新LCD显示void camera_refresh(void){u32 j; u16 color;u32 sendCount=0; u8 tmp_buf[32];NRF24L01_TX_Mode();if(ov_sta==2){LCD_Scan_Dir(U2D_L2R);//从上到下,从左到右 LCD_SetCursor(0x00,0x0000);//设置光标位置 LCD_WriteRAM_Prepare();     //开始写入GRAMOV7670_RRST=0;//开始复位读指针 OV7670_RCK=0;OV7670_RCK=1;OV7670_RCK=0;OV7670_RRST=1;//复位读指针结束 OV7670_RCK=1;  for(j=0;j<76800;j++){OV7670_RCK=0;color=GPIOC->IDR&0XFF;//读数据tmp_buf[sendCount++]=GPIOC->IDR&0XFF;OV7670_RCK=1; color<<=8;  OV7670_RCK=0;color|=GPIOC->IDR&0XFF;//读数据tmp_buf[sendCount++]=GPIOC->IDR&0XFF;OV7670_RCK=1; LCD->LCD_RAM=color;  if(sendCount>=32){sendCount=0;while(NRF24L01_TxPacket(tmp_buf)!=TX_OK);//等待数据发送完毕}  }   EXTI->PR=1<<8;     //清除LINE8上的中断标志位 ov_sta=0;//开始下一次采集NRF24L01_RX_Mode();//配置为接收模式while(NRF24L01_RxPacket(tmp_buf)!=0);//等待同步信号 }} int main(void){u32 count;u8 SendCount=0;u8 tmp_buf[32]; STM32_Clock_Init(9);//系统时钟设置uart_init(72,9600); //串口初始化为9600delay_init(72);    //延时初始化 usmart_dev.init(72);//初始化USLCD_Init();   //初始化LCDNRF24L01_Init();    //初始化NRF24L01OV7670_Init();     POINT_COLOR=RED;//设置字体为红色 LCD_ShowString(60,50,200,16,16,"WarShip STM32");LCD_ShowString(60,70,200,16,16,"OV7670 TEST");LCD_ShowString(60,90,200,16,16,"ATOM@ALIENTEK");LCD_ShowString(60,110,200,16,16,"2012/9/14");  LCD_ShowString(60,130,200,16,16,"KEY0:Light Mode");LCD_ShowString(60,150,200,16,16,"KEY1:Saturation");LCD_ShowString(60,170,200,16,16,"KEY2:Brightness");LCD_ShowString(60,190,200,16,16,"KEY_UP:Contrast");LCD_ShowString(60,210,200,16,16,"TPAD:Effects");   LCD_ShowString(60,230,200,16,16,"OV7670 Init...");  while(OV7670_Init())//初始化OV7670{LCD_ShowString(60,230,200,16,16,"OV7670 Error!!");delay_ms(200);    LCD_Fill(60,230,239,246,WHITE);delay_ms(200);} LCD_ShowString(60,230,200,16,16,"OV7670 Init OK");delay_ms(1500); LCD_Clear(WHITE);while(NRF24L01_Check())//检查NRF24L01是否在位.{LCD_ShowString(60,130,200,16,16,"NRF24L01 Error");delay_ms(200);LCD_Fill(60,130,239,130+16,WHITE); delay_ms(200);}   LCD_ShowString(60,130,200,16,16,"NRF24L01 OK");     EXTI8_Init();//使能定时器捕获帧同步信号OV7670_Window_Set(10,174,240,320);//设置窗口    OV7670_CS=0;NRF24L01_RX_Mode();//配置为接收模式while(NRF24L01_RxPacket(tmp_buf)!=0);//等待同步信号   while(1){camera_refresh();//更新显示}   }







这是我接收代码


[C] 纯文本查看 复制代码
#include "sys.h"#include "usart.h"#include "delay.h"#include "led.h" #include "beep.h"  #include "key.h"  #include "exti.h"  #include "wdg.h"  #include "timer.h"  #include "tpad.h"#include "oled.h"  #include "lcd.h"#include "usmart.h"#include "rtc.h"  #include "wkup.h"#include "adc.h"  #include "dac.h"  #include "dma.h"  #include "24cxx.h"  #include "flash.h"  #include "rs485.h"  #include "can.h"  #include "touch.h"  #include "remote.h"  #include "joypad.h"#include "adxl345.h"#include "ds18b20.h"#include "dht11.h"#include "24l01.h"#include "mouse.h"#include "stmflash.h"#include "rda5820.h"#include "audiosel.h"#include "ov7670.h"#include "sram.h"#include "malloc.h"#include "string.h" int main(void){u32 count=0;u32 receivecount=0;//记录接收到的数据,当其大于320*240*2时重置为0u32 ReceiveCount=0;u8* showbuf;u8* a;   u16 color; Stm32_Clock_Init(9);//系统时钟设置uart_init(72,9600); //串口初始化为9600delay_init(72);    //延时初始化 LCD_Init();   //初始化LCDusmart_dev.init(72);//初始化USMARTNRF24L01_Init();//初始化无线模块FSMC_SRAM_Init();//初始化外部SRAMmem_init(SRAMEX);LCD_Clear(WHITE);while(NRF24L01_Check())//检查NRF24L01是否在位.{LCD_ShowString(60,130,200,16,16,"NRF24L01 Error");delay_ms(200);LCD_Fill(60,130,239,130+16,WHITE); delay_ms(200);}   LCD_ShowString(60,130,200,16,16,"NRF24L01 OK");showbuf=(u8*)mymalloc(SRAMEX,240*320*2+5);a=showbuf; //记录初始地址NRF24L01_TX_Mode();//配置为发送模式while(NRF24L01_TxPacket(showbuf)!=0);//发送同步信号通知开始采集图像delay_ms(1000);NRF24L01_RX_Mode();//配置为接收模式LCD_Scan_Dir(U2D_L2R);//从上到下,从左到右 LCD_SetCursor(0x00,0x0000);//设置光标位置 LCD_WriteRAM_Prepare();     //开始写入GRAMNRF24L01_RX_Mode();//配置为接收模式  while(1){while(NRF24L01_RxPacket(showbuf)!=0);//等待数据接收完毕showbuf +=32;receivecount +=32;if(receivecount >=(320*240*2))//接收了一屏数据{showbuf =a;receivecount=0;for(count=0;count<320*240;count++){color=showbuf[receivecount++]&0XFF;//读数据color<<=8;  color|=showbuf[receivecount++]&0XFF;//读数据 LCD->LCD_RAM=color;//向tft屏写入一个点}showbuf =a;NRF24L01_TX_Mode();//配置为发送模式while(NRF24L01_TxPacket(showbuf)!=0);//发送同步信号 通知采集下一帧NRF24L01_RX_Mode();//配置为接收模式LCD_SetCursor(0x00,0x0000);//设置光标位置 LCD_WriteRAM_Prepare();     //开始写入GRAM } }   }


回帖(1)

盛方圆

2020-5-7 10:12:48
慢慢调试了..
举报

更多回帖

相关问答

OV7670
发帖
登录/注册
×
20
完善资料,
赚取积分