初始化没问题,摄像头对外界变化也有响应。但只有仔细看才能看出图像,很模糊而且好像屏幕被分成了三份显示。具体情况图片和程序在下面。//¸üDÂLCDÏÔê¾(OV7725)
void OV7725_camera_refresh(void)
{
u32 i,j;
u16 color;
if(ov_sta==2)//óDÖ¡ÖD¶Ï¸üDÂ
{
LCD_Set_Window(0,(tftlcd_data.height-240)/2,320-1,240-1);//½«ÏÔê¾ÇøóòéèÖÃμ½ÆáÄ»ÖDÑë
OV7725_RRST=0; //¿a꼸′λ¶áÖ¸Õë
OV7725_RCK_L;
OV7725_RCK_H;
OV7725_RCK_L;
OV7725_RRST=1; //¸′λ¶áÖ¸Õë½áêø
OV7725_RCK_H;
for(i=0;i<240;i++)
{
for(j=0;j<320;j++)
{
OV7725_RCK_L;
color=OV7725_DATA; //¶áêy¾Y
OV7725_RCK_H;
color<<=8;
OV7725_RCK_L;
color|=OV7725_DATA; //¶áêy¾Y
OV7725_RCK_H;
LCD_WriteData_Color(color);
}
}
ov_sta=0; //ÇåáãÖ¡ÖD¶Ï±ê¼Ç
}
}
int main()
{
u8 i=0;
SysTick_Init(168);
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2); //ÖD¶ÏóÅÏ輶·Ö×é ·Ö2×é
LED_Init();
USART1_Init(9600);
TFTLCD_Init(); //LCD3õê¼»ˉ
FRONT_COLOR=BLACK;
LCD_ShowString(10,10,tftlcd_data.width,tftlcd_data.height,12,"Hello World!");
while(1)
{
if(OV7725_Init()==0)
{
LCD_ShowString(30,230,200,16,16,"OV7725 Init OK");
OV7725_Window_Set(OV7725_WINDOW_WIDTH,OV7725_WINDOW_HEIGHT,1);//QVGAÄ£ê½êä3ö
OV7725_Light_Mode(1);//1aÕÕÄ£ê½3
OV7725_Color_Saturation(2);//±¥oí¶è
OV7725_Brightness(1);//áá¶è
OV7725_Contrast(2);//¶Ô±è¶è
OV7725_Special_Effects(0);//éèÖÃìØD§3
OV7725_CS=0;//ê1Äüov7725
break;
}
else
{
LCD_ShowString(30,230,200,16,16,"OV7725 Error!!");
delay_ms(200);
LCD_Fill(30,230,239,246,WHITE);
delay_ms(200);
}
}
EXTI7_Init(); //ê1Äü¶¨ê±Æ÷2¶»ñ
LCD_Clear(BLACK);
LCD_ShowString(30,280,200,16,16,"OV7725 OK!!");
while(1)
{
OV7725_camera_refresh();//¸üDÂÏÔê¾
i++;
if(i%20==0)
{
led1=!led1;
}
}
}
//ía2¿ÖD¶Ï5~9·tÎñ3ìDò
void EXTI9_5_IRQHandler(void)
{
if(EXTI_GetITStatus(EXTI_Line7)==SET) //êÇ8ÏßμÄÖD¶Ï
{
if(ov_sta<2)
{
if(ov_sta==0)
{
OV7725_WRST=0; //¸′λD′Ö¸Õë
OV7725_WRST=1;
OV7725_WREN=1; //ÔêDíD′èëFIFO
}
else OV7725_WREN=0; //½ûÖ1D′èëFIFO
ov_sta++; //Ö¡ÖD¶Ï¼ó1
}
}
EXTI_ClearITPendingBit(EXTI_Line7); //Çå3yEXTI8Ïß·1òÆeλ
}
友情提示: 此问题已得到解决,问题已经关闭,关闭后问题禁止继续编辑,回答。
图像前面有多余的数据 删减下
一周热门 更多>