智能车制作
标题:
ov7725摄像头
[打印本页]
作者:
huahuajihj
时间:
2016-6-4 22:08
标题:
ov7725摄像头
我用的是瑞萨单片机驱动ov7725摄像头,结果采集的图像是这样的,希望大家可以帮帮我。代码如下!
unsigned int Ov7725_Init() //ov7725初始化
{
uint16_t i = 0;
uint8_t Sensor_IDCode = 0;
// DEBUG("ov7725 Register Config Start......");
if(SCCB_WriteByte ( 0x12, 0x80 )==0) /*sensor */
{
//DEBUG("sccb write data error");
//User_Delay(50);
return ERROR ;
}
// User_Delay(50);
if( 0 == SCCB_ReadByte( &Sensor_IDCode, 1, 0x0b ) ) /* ??sensor ID?*/
{
//DEBUG("read id faild");
return ERROR;
}
//DEBUG("Sensor ID is 0x%x", Sensor_IDCode);
if(Sensor_IDCode == OV7725_ID)
{
for( i = 0 ; i < OV7725_REG_NUM ; i++ )
{
if( 0 == SCCB_WriteByte(Sensor_Config[i].Address, Sensor_Config[i].Value) )
{
//DEBUG("write reg faild", Sensor_Config[i].Address);
return ERROR;
}
}
}
else
{
return ERROR;
}
//DEBUG("ov7725 Register Config Success");
return SUCCESS;
}
void get_image() //采集并用上位机显示
{
uint8_t ca_data;
// uint8_t dat[H_RESOLUTION*W_RESOLUTION*2];
uint16_t i,j;
long flag=0;
for(i=0;i<W_RESOLUTION;i++)
{
for(j=0;j<H_RESOLUTION;j++)
{
READ_FIFO_PIXEL(ca_data);
// dat[flag]=ca_data;
R_UART0_Send_Data(&ca_data,1);
// flag++;
// READ_FIFO_PIXEL(ca_data);
// dat[flag]=ca_data;
// R_UART0_Send_Data(&ca_data,1);
// flag++;
}
}
}
__interrupt static void r_intc8_interrupt(void) //场中断
{
/* Start user code. Do not edit comment generated here */
if( Ov7725_vsync == 0 )
{
FIFO_WRST_L();
FIFO_WE_H();
Ov7725_vsync = 1;
FIFO_WE_H();
FIFO_WRST_H();
}
else if( Ov7725_vsync == 1 )
{
FIFO_WE_L();
Ov7725_vsync = 2;
}
/* End user code. Do not edit comment generated here */
}
作者:
高少
时间:
2017-7-26 17:31
试着调帧数
欢迎光临 智能车制作 (http://111.231.132.190/)
Powered by Discuz! X3.2