中级会员
- 积分
- 312
- 威望
- 168
- 贡献
- 94
- 兑换币
- 96
- 注册时间
- 2016-5-20
- 在线时间
- 25 小时
|
我用的是瑞萨单片机驱动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 */
}
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|