STM32调试OV7670,用的奋斗V5开发板+3寸屏,YUYV输出,灰度值读取正确,并且能在LCD上正确显示,本想二值化后显示到LCD上,但二值化后,LCD不是全黑,阈值调过,无效,所以把灰度值送给上位机,上位机显示不正常,求大神相助
USART_SendData(USART1,0xff );
for(y=0;y<240;y++)
{ for(x=0;x<320;x++)
{ FIFO_RCLK_L();
CMOS_Data = ((GPIOC->IDR<<8) & 0xff00);
grey=GPIOC->IDR&0X00FF ;
FIFO_RCLK_H();
FIFO_RCLK_L();
//CMOS_Data |= (((GPIOC->IDR) & 0x00ff));
FIFO_RCLK_H();
if (grey==0xff)
grey=0xfe;
USART_SendData(USART1,grey );
color_r = CMOS_Data&0xf800;
color_b = CMOS_Data>>11; CMOS_Data >>=5;
color_g =CMOS_Data&0x07e0;
Y_565=color_r + color_g + color_b; //YUV转RGB565数据写入显示区
*(__IO uint16_t *) (Bank1_LCD_D)=(Y_565);
} }
Vsync = 0; |