问题如下:
8 OV7670_read_reg(u8 reg,u8 *data)
{
SCCB_Start();
if(1==SCCB_Write_byte(0x42)) {printf("\r\n SCCB_Read error\r\n");SCCB_stop(); return 1;} //成功了啊 ,0x43,读寄存器地址
__nop();
__nop();
__nop();
SCCB_delay();
SCCB_delay();
if(1==SCCB_Write_byte(reg)) {printf("\r\n SCCB_Read(reg) error \r\n");SCCB_stop(); return 1;}
SCCB_stop();
__nop();
__nop();
__nop();
SCCB_delay();
///////分水岭/////
SCCB_Start();
if(1==SCCB_Write_byte(0x43)) {SCCB_stop(); return 1;}
*data=SCCB_Receive_byte();
SCCB_NoAck();
SCCB_stop();
SCCB_delay();
return 0;
}
这个读操作函数,在读写第一个字节时是对的,就是读0x42是对的,对后面的reg就不对了,直接错误,《《???》》 |