搜索
bottom↓
回复: 4

关于OV7660窗口像素设置函数的疑问!!

[复制链接]

出0入0汤圆

发表于 2010-12-12 21:11:33 | 显示全部楼层 |阅读模式
//(140,16,640,480) is good for VGA
//(272,16,320,240) is good for QVGA
/* config_OV7660_window */
void OV7660_config_window(uint startx,uint starty,uint width, uint height)
{
        uint endx=(startx+width);
        uint endy=(starty+height*2);// "v*2"必须
        uchar temp_reg1, temp_reg2;
        uchar state,temp;
       
        state = rdOV7660Reg(0x03, &temp_reg1 );
        temp_reg1 &= 0xC0;
        state = rdOV7660Reg(0x32, &temp_reg2 );
        temp_reg2 &= 0xC0;
       
        // Horizontal
        temp = temp_reg2|((endx&0x7)<<3)|(startx&0x7);
        state = wrOV7660Reg(0x32, temp );
        temp = (startx&0x7F8)>>3;
        state = wrOV7660Reg(0x17, temp );
        temp = (endx&0x7F8)>>3;
        state = wrOV7660Reg(0x18, temp );
       
        // Vertical
        temp = temp_reg1|((endy&0x7)<<3)|(starty&0x7);
        state = wrOV7660Reg(0x03, temp );
        temp = (starty&0x7F8)>>3;
        state = wrOV7660Reg(0x19, temp );
        temp = (endy&0x7F8)>>3;
        state = wrOV7660Reg(0x1A, temp );
}
这个函数中:uint endx=(startx+width);
         uint endy=(starty+height*2);// "v*2"必须

这两个语句是什么意思??
startx和starty的值有什么特殊要求吗??
为什么starty 要加两次 height??
如果要设置成QQVGA的格式该怎么设置???

阿莫论坛20周年了!感谢大家的支持与爱护!!

一只鸟敢站在脆弱的枝条上歇脚,它依仗的不是枝条不会断,而是自己有翅膀,会飞。

出0入0汤圆

 楼主| 发表于 2010-12-13 12:42:41 | 显示全部楼层
没人知道吗???

出0入0汤圆

 楼主| 发表于 2010-12-13 13:16:51 | 显示全部楼层
还有我查看了一下。。。DATSHEET。。。感觉应该
// Vertical
temp = temp_reg1|((endy&0x7)<<3)|(starty&0x7);
state = wrOV7660Reg(0x03, temp );
temp = (starty&0x7F8)>>3;
state = wrOV7660Reg(0x19, temp );
temp = (endy&0x7F8)>>3;
state = wrOV7660Reg(0x1A, temp );
设置有问题!!!帧方向应该是低两位和高八位。。。所以因该是这样设置:

temp = temp_reg1|((endy&0x3)<<2)|(starty&0x3);//取垂直像素开始和结束的低两位并且结束低两位取完后左移两位
        state = wrOV7660Reg(0x03, temp );//设置垂直像素开始和结束低两位,开始低两位在1~0,结束低三位在3~2
        temp = (starty&0x7FC)>>2;
        state = wrOV7660Reg(0x19, temp );//设置垂直像素开始高八位
        temp = (endy&0x7FC)>>2;
        state = wrOV7660Reg(0x1A, temp ); //设置垂直像素结束高八位

出0入0汤圆

 楼主| 发表于 2010-12-13 13:18:01 | 显示全部楼层
这是经过我注释的:


/(140,16,640,480) is good for VGA
//(272,16,320,240) is good for QVGA
/* config_OV7660_window */
void OV7660_config_window(uint startx,uint starty,uint width, uint height)
{
        uint endx=(startx+width);
        uint endy=(starty+height*2);// "v*2"必须
        uchar temp_reg1, temp_reg2;
        uchar state,temp;
       
        state = rdOV7660Reg(0x03, &temp_reg1 );
        temp_reg1 &= 0xC0;
        state = rdOV7660Reg(0x32, &temp_reg2 );
        temp_reg2 &= 0xC0;
       
        // Horizontal -水平
        temp = temp_reg2|((endx&0x7)<<3)|(startx&0x7);//取水平像素开始和结束的低三位并且结束低三位取完后左移三位
        state = wrOV7660Reg(0x32, temp );//设置水平像素开始和结束低三位,开始低三位在2~0,结束低三位在5~3
        temp = (startx&0x7F8)>>3;
        state = wrOV7660Reg(0x17, temp );  //设置水平像素开始高八位
        temp = (endx&0x7F8)>>3;
        state = wrOV7660Reg(0x18, temp );   //设置水平像素结束高八位
       
        // Vertical-垂直
        /*temp = temp_reg1|((endy&0x7)<<3)|(starty&0x7);
        state = wrOV7660Reg(0x03, temp );
        temp = (starty&0x7F8)>>3;
        state = wrOV7660Reg(0x19, temp );
        temp = (endy&0x7F8)>>3;
        state = wrOV7660Reg(0x1A, temp );*/
        temp = temp_reg1|((endy&0x3)<<2)|(starty&0x3);//取垂直像素开始和结束的低两位并且结束低两位取完后左移两位
        state = wrOV7660Reg(0x03, temp );//设置垂直像素开始和结束低两位,开始低两位在1~0,结束低三位在3~2
        temp = (starty&0x7FC)>>2;
        state = wrOV7660Reg(0x19, temp );//设置垂直像素开始高八位
        temp = (endy&0x7FC)>>2;
        state = wrOV7660Reg(0x1A, temp ); //设置垂直像素结束高八位
}

出0入0汤圆

发表于 2016-6-27 18:13:15 | 显示全部楼层
TKWTKW 发表于 2010-12-13 13:18
这是经过我注释的:

你测试可以吗?
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-6-12 11:50

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表