高级会员
- 积分
- 670
- 威望
- 367
- 贡献
- 197
- 兑换币
- 210
- 注册时间
- 2015-3-15
- 在线时间
- 53 小时
- 毕业学校
- 安徽工业大学
|
3#
楼主 |
发表于 2015-4-19 22:10:18
|
只看该作者
********* AHUT工商学院404工作室 **********
* File :MK60_it.c
* Remark :中断服务程序
* Author :Liuyifan
* Version :V1.0
* Date :2014-03-31
*********************************************/
#include "common.h"
#include "include.h"
#include "parameter.h"
//延时函数做采集间隔用
#define Webcam_Delay \
{ \
asm("nop");asm("nop");asm("nop");asm("nop");asm("nop"); \
asm("nop");asm("nop");asm("nop");asm("nop");asm("nop"); \
asm("nop");asm("nop");asm("nop");asm("nop");asm("nop"); \
asm("nop");asm("nop");asm("nop");asm("nop");asm("nop"); \
asm("nop");asm("nop");asm("nop"); \
}
/********** 所用变量 **********/
uchar image[ROW][LINE];
uchar image_buf[LINE];
uchar row_count_forward; //正向摄像头行计数
uchar collect_flag_f; //正向摄像头采集标志
uchar row_no_f; //正向摄像头采集行数
uchar row_finish_flag_f; //正向摄像头一行采集结束标志
uchar image_handle_flag_f; //正向摄像头图像处理标志
//数据存储
void Row_Getvalue(uchar row)
{
image[row][119]=PORTDATA_FORWARD;
Webcam_Delay
image[row][118]=PORTDATA_FORWARD;
Webcam_Delay
image[row][117]=PORTDATA_FORWARD;
Webcam_Delay
image[row][116]=PORTDATA_FORWARD;
Webcam_Delay
image[row][115]=PORTDATA_FORWARD;
Webcam_Delay
image[row][114]=PORTDATA_FORWARD;
Webcam_Delay
image[row][113]=PORTDATA_FORWARD;
Webcam_Delay
image[row][112]=PORTDATA_FORWARD;
Webcam_Delay
image[row][111]=PORTDATA_FORWARD;
Webcam_Delay
image[row][110]=PORTDATA_FORWARD;
Webcam_Delay
image[row][109]=PORTDATA_FORWARD;
Webcam_Delay
image[row][108]=PORTDATA_FORWARD;
Webcam_Delay
image[row][107]=PORTDATA_FORWARD;
Webcam_Delay
image[row][106]=PORTDATA_FORWARD;
Webcam_Delay
image[row][105]=PORTDATA_FORWARD;
Webcam_Delay
image[row][104]=PORTDATA_FORWARD;
Webcam_Delay
image[row][103]=PORTDATA_FORWARD;
Webcam_Delay
image[row][102]=PORTDATA_FORWARD;
Webcam_Delay
image[row][101]=PORTDATA_FORWARD;
Webcam_Delay
image[row][100]=PORTDATA_FORWARD;
Webcam_Delay
image[row][99]=PORTDATA_FORWARD;
Webcam_Delay
image[row][98]=PORTDATA_FORWARD;
Webcam_Delay
image[row][97]=PORTDATA_FORWARD;
Webcam_Delay
image[row][96]=PORTDATA_FORWARD;
Webcam_Delay
image[row][95]=PORTDATA_FORWARD;
Webcam_Delay
image[row][94]=PORTDATA_FORWARD;
Webcam_Delay
image[row][93]=PORTDATA_FORWARD;
Webcam_Delay
image[row][92]=PORTDATA_FORWARD;
Webcam_Delay
image[row][91]=PORTDATA_FORWARD;
Webcam_Delay
image[row][90]=PORTDATA_FORWARD;
Webcam_Delay
image[row][89]=PORTDATA_FORWARD;
Webcam_Delay
image[row][88]=PORTDATA_FORWARD;
Webcam_Delay
image[row][87]=PORTDATA_FORWARD;
Webcam_Delay
image[row][86]=PORTDATA_FORWARD;
Webcam_Delay
image[row][85]=PORTDATA_FORWARD;
Webcam_Delay
image[row][84]=PORTDATA_FORWARD;
Webcam_Delay
image[row][83]=PORTDATA_FORWARD;
Webcam_Delay
image[row][82]=PORTDATA_FORWARD;
Webcam_Delay
image[row][81]=PORTDATA_FORWARD;
Webcam_Delay
image[row][80]=PORTDATA_FORWARD;
Webcam_Delay
image[row][79]=PORTDATA_FORWARD;
Webcam_Delay
image[row][78]=PORTDATA_FORWARD;
Webcam_Delay
image[row][77]=PORTDATA_FORWARD;
Webcam_Delay
image[row][76]=PORTDATA_FORWARD;
Webcam_Delay
image[row][75]=PORTDATA_FORWARD;
Webcam_Delay
image[row][74]=PORTDATA_FORWARD;
Webcam_Delay
image[row][73]=PORTDATA_FORWARD;
Webcam_Delay
image[row][72]=PORTDATA_FORWARD;
Webcam_Delay
image[row][71]=PORTDATA_FORWARD;
Webcam_Delay
image[row][70]=PORTDATA_FORWARD;
Webcam_Delay
image[row][69]=PORTDATA_FORWARD;
Webcam_Delay
image[row][68]=PORTDATA_FORWARD;
Webcam_Delay
image[row][67]=PORTDATA_FORWARD;
Webcam_Delay
image[row][66]=PORTDATA_FORWARD;
Webcam_Delay
image[row][65]=PORTDATA_FORWARD;
Webcam_Delay
image[row][64]=PORTDATA_FORWARD;
Webcam_Delay
image[row][63]=PORTDATA_FORWARD;
Webcam_Delay
image[row][62]=PORTDATA_FORWARD;
Webcam_Delay
image[row][61]=PORTDATA_FORWARD;
Webcam_Delay
image[row][60]=PORTDATA_FORWARD;
Webcam_Delay
image[row][59]=PORTDATA_FORWARD;
Webcam_Delay
image[row][58]=PORTDATA_FORWARD;
Webcam_Delay
image[row][57]=PORTDATA_FORWARD;
Webcam_Delay
image[row][56]=PORTDATA_FORWARD;
Webcam_Delay
image[row][55]=PORTDATA_FORWARD;
Webcam_Delay
image[row][54]=PORTDATA_FORWARD;
Webcam_Delay
image[row][53]=PORTDATA_FORWARD;
Webcam_Delay
image[row][52]=PORTDATA_FORWARD;
Webcam_Delay
image[row][51]=PORTDATA_FORWARD;
Webcam_Delay
image[row][50]=PORTDATA_FORWARD;
Webcam_Delay
image[row][49]=PORTDATA_FORWARD;
Webcam_Delay
image[row][48]=PORTDATA_FORWARD;
Webcam_Delay
image[row][47]=PORTDATA_FORWARD;
Webcam_Delay
image[row][46]=PORTDATA_FORWARD;
Webcam_Delay
image[row][45]=PORTDATA_FORWARD;
Webcam_Delay
image[row][44]=PORTDATA_FORWARD;
Webcam_Delay
image[row][43]=PORTDATA_FORWARD;
Webcam_Delay
image[row][42]=PORTDATA_FORWARD;
Webcam_Delay
image[row][41]=PORTDATA_FORWARD;
Webcam_Delay
image[row][40]=PORTDATA_FORWARD;
Webcam_Delay
image[row][39]=PORTDATA_FORWARD;
Webcam_Delay
image[row][38]=PORTDATA_FORWARD;
Webcam_Delay
image[row][37]=PORTDATA_FORWARD;
Webcam_Delay
image[row][36]=PORTDATA_FORWARD;
Webcam_Delay
image[row][35]=PORTDATA_FORWARD;
Webcam_Delay
image[row][34]=PORTDATA_FORWARD;
Webcam_Delay
image[row][33]=PORTDATA_FORWARD;
Webcam_Delay
image[row][32]=PORTDATA_FORWARD;
Webcam_Delay
image[row][31]=PORTDATA_FORWARD;
Webcam_Delay
image[row][30]=PORTDATA_FORWARD;
Webcam_Delay
image[row][29]=PORTDATA_FORWARD;
Webcam_Delay
image[row][28]=PORTDATA_FORWARD;
Webcam_Delay
image[row][27]=PORTDATA_FORWARD;
Webcam_Delay
image[row][26]=PORTDATA_FORWARD;
Webcam_Delay
image[row][25]=PORTDATA_FORWARD;
Webcam_Delay
image[row][24]=PORTDATA_FORWARD;
Webcam_Delay
image[row][23]=PORTDATA_FORWARD;
Webcam_Delay
image[row][22]=PORTDATA_FORWARD;
Webcam_Delay
image[row][21]=PORTDATA_FORWARD;
Webcam_Delay
image[row][20]=PORTDATA_FORWARD;
Webcam_Delay
image[row][19]=PORTDATA_FORWARD;
Webcam_Delay
image[row][18]=PORTDATA_FORWARD;
Webcam_Delay
image[row][17]=PORTDATA_FORWARD;
Webcam_Delay
image[row][16]=PORTDATA_FORWARD;
Webcam_Delay
image[row][15]=PORTDATA_FORWARD;
Webcam_Delay
image[row][14]=PORTDATA_FORWARD;
Webcam_Delay
image[row][13]=PORTDATA_FORWARD;
Webcam_Delay
image[row][12]=PORTDATA_FORWARD;
Webcam_Delay
image[row][11]=PORTDATA_FORWARD;
Webcam_Delay
image[row][10]=PORTDATA_FORWARD;
Webcam_Delay
image[row][9]=PORTDATA_FORWARD;
Webcam_Delay
image[row][8]=PORTDATA_FORWARD;
Webcam_Delay
image[row][7]=PORTDATA_FORWARD;
Webcam_Delay
image[row][6]=PORTDATA_FORWARD;
Webcam_Delay
image[row][5]=PORTDATA_FORWARD;
Webcam_Delay
image[row][4]=PORTDATA_FORWARD;
Webcam_Delay
image[row][3]=PORTDATA_FORWARD;
Webcam_Delay
image[row][2]=PORTDATA_FORWARD;
Webcam_Delay
image[row][1]=PORTDATA_FORWARD;
Webcam_Delay
image[row][0]=PORTDATA_FORWARD;
}
/********** 各中断服务程序 **********/
void PORTE_IRQHandler()
{
}
void PORTB_IRQHandler()
{
}
void PORTC_IRQHandler() //正向摄像头
{
uchar field,row;
uint row_count_temp;
field=19; //场信号引脚号TC19
row=17; //行信号引脚号:PTC17
if(PORTC_ISFR&(1<<field))
{
PORTC_ISFR=(1<<field); //清场信号中断标志
// ***** 场信号中断服务程序 *****
row_count_forward=0;
collect_flag_f=1; //采集标志置1,行信号中断服务程序判断为1做数据采集
}
else if(PORTC_ISFR&(1<<row))
{
PORTC_ISFR=(1<<row); //清行信号中断标志
// ***** 行信号中断服务程序 *****
if(collect_flag_f==1)
{
if(row_count_forward<80) //前80行进行数据采集、确定(隔4行采1行)
{
row_count_temp=row_count_forward%4;
if(row_count_temp==0)
{
row_count_temp=row_count_forward/4;
row_no_f=(uchar)row_count_temp;
Row_Getvalue(row_no_f);
row_finish_flag_f=1; //一行采集完置1,主程序行滤波完清0
}
row_count_forward++;
}
else if(row_count_forward<140) //前中间60行进行数据采集、确定(隔3行采1行)
{
row_count_temp=(row_count_forward-80)%3;
if(row_count_temp==0)
{
row_count_temp=(row_count_forward-80)/3+20;
row_no_f=(uchar)row_count_temp;
Row_Getvalue(row_no_f);
row_finish_flag_f=1; //一行采集完置1,主程序行滤波完清0
}
row_count_forward++;
}
else if(row_count_forward==140) //140行到240行进行数据分析
{
image_handle_flag_f=1; //图像处理标志置1,主程序判断为1做图像分析及控制
row_count_forward++;
collect_flag_f=0; //采集标志清0
}
}
}
}
void PORTA_IRQHandler()
{
uchar field,row;
field=28; //场信号引脚号:PTA28
row=26; //行信号引脚号:PTA26
if(PORTA_ISFR&(1<<field))
{
PORTA_ISFR=(1<<field); //清场信号中断标志
// ***** 场信号中断服务程序 *****
}
else if(PORTA_ISFR&(1<<row))
{
PORTA_ISFR=(1<<row); //清行信号中断标志
// ***** 行信号中断服务程序 *****
}
}
现在的场中断引脚为PTB8,行中断引脚为PTC17, |
|