2019-08-14 15:22发布
正点原子 发表于 2016-7-16 00:42 试试这个:http://www.openedv.com/thread-65762-1-1.html
最多设置5个标签!
谢谢原子哥!!
#include "delay.h"
#include "usart.h"
#include "exti.h"
#include "usmart.h"
#include "ov7670.h"
//ALIENTEK精英STM32F103开发板 实验33
//摄像头实验 实验
//技术支持:www.openedv.com
//广州市星翼电子科技有限公司
//const u8*LMODE_TBL[5]={"Auto","Sunny","Cloudy","Office","Home"}; //5种光照模式
//const u8*EFFECTS_TBL[7]={"Normal","Negative","B&W","Redish","Greenish","Bluish","Antique"}; //7种特效
extern u8 ov_sta; //在exit.c里 面定义
//extern u8 ov_frame; //在timer.c里面定义
u16 TEXT_TO_SEND[120][240];
//更新LCD显示
void camera_refresh(void)
{
u32 i,j;
u16 color;
if(ov_sta)//有帧中断更新?
{
OV7670_RRST=0; //开始复位读指针
OV7670_RCK_L;
OV7670_RCK_H;
OV7670_RCK_L;
OV7670_RRST=1; //复位读指针结束
OV7670_RCK_H;
usart1_send_char(0XFF); //数据头
for(i=0;i<120;i++)
for(j=0;j<240;j++)
{
OV7670_RCK_L;
color=GPIOC->IDR&0XFF; //读数据
OV7670_RCK_H;
TEXT_TO_SEND[j]=color;
color<<=8;
OV7670_RCK_L;
color|=GPIOC->IDR&0XFF; //读数据
OV7670_RCK_H;
TEXT_TO_SEND[j+1]=color;
}
for(i=0;i<120;i++)
for(j=0;j<240;j++)
{
usart1_send_char(TEXT_TO_SEND[j]);
}
ov_sta=0; //清零帧中断标记
//ov_frame++;
}
}
int main(void)
{
u8 lightmode=0,saturation=2,contrast=2;
u8 effect=0;
Stm32_Clock_Init(9); //系统时钟设置
uart_init(72,115200); //串口初始化为115200
delay_init(72); //延时初始化
usmart_dev.init(72); //初始化USMART
OV7670_Init();//初始化OV7670
delay_ms(200);
OV7670_Light_Mode(lightmode);
OV7670_Color_Saturation(saturation);
OV7670_Contrast(contrast);
OV7670_Special_Effects(effect);
//TIM6_Int_Init(10000,7199); //10Khz计数频率,1秒钟中断
EXTI8_Init(); //使能定时器捕获
OV7670_Window_Set(12,174,240,320); //设置窗口
OV7670_CS=0;
while(1)
{
camera_refresh();//更新显示
}
}
{0x68, 0xff}, 读出来的数据 不是XX11,XXFF的?
求大神
一周热门 更多>