在320X240的液晶上显示qvga,一切正常。打算让摄像头显示在窗口280X200,怎么都是错位。
void OV_HW(unsigned int hstart, unsigned int hstop, unsigned int vstart, unsigned int vstop)
{
uint8_t v;
OV7670_WriteReg(0x17, (hstart >> 3) & 0xff); //HSTART
OV7670_WriteReg(0x18, (hstop >> 3) & 0xff); //HSTOP
OV7670_ReadReg(0x32,&v);
v = (v & 0xc0) | ((hstop & 0x7) << 3) | (hstart & 0x7);
OV7670_WriteReg(0x32, v); //HREF
OV7670_WriteReg(0x19, (vstart >> 2) & 0xff); //VSTART 开始高8位
OV7670_WriteReg(0x1a, (vstop >> 2) & 0xff); //VSTOP 结束高8位
OV7670_ReadReg(0x03,&v );
v = (v & 0xf0) | ((vstop & 0x3) << 2) | (vstart & 0x3);
OV7670_WriteReg(0x03, v); //VREF
OV7670_WriteReg(0x11, 0x00);
}
忘记说了,OV7670_config_window函数的前两个参数是固定的,比如你要设置160x120大小的画面,参数是这样的,OV7670_config_window(184,10,160,120);
还有一个就是LCD开窗的大小也要设置成160x120。
一周热门 更多>