




下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
Main.c
#include<hidef.h>/*commondefinesandmacros*/
#include<mc9s12db128.h>/*derivativeinformation*/
#pragmaLINK_INFODERIVATIVE"mc9s12db128b"
#include"define.h"
#include"init.h"
//variableusedinvideoprocess
volatileunsignedcharimage_data[ROW_MAX][LINE_MAX];//dataarrayofpicture
unsignedcharblack_x[ROW_MAX];//0ne-dimensionalarray
unsignedcharrow;//x-positionofthearray
unsignedcharline;//y-positionofthearray
unsignedintrow_count;//rowcounter
unsignedcharline_sample;//usedtocounterinAD
unsignedcharrow_image;
unsignedcharline_temp;//temperaryvariableusedindatatransfer
unsignedcharsample_data[LINE_MAX];//usedtosaveone-dimensionarraygotin
interruption
//variablesbelowareusedinspeedmeasure
Unsignedcharpulse[5];//usedtosavedatainPAprocess
Unsignedcharcounter;//temporarycounterinSpeeddetect
Unsignedcharcur_speed;//currentspeed
shortstand;
shortdata;
unsignedcharcurve;//valveusedtodecidestraightorturn
shortBounds(shortdata);
shortFuzzyLogic(shortstand);
/*----------------------------------------------------------------------------*\
receive_sci
\*----------------------------------------------------------------------------*/
unsignedcharreceive_sci(void)//receivedatathroughsci
{unsignedcharsci_data;
while(SCI0SR1_RDRF!=1);
sci_data=SCI0DRL;
returnsci_data;
}
/*----------------------------------------------------------------------------*\
transmit_sci
\*----------------------------------------------------------------------------*/
voidtransmit_sci(unsignedchartransmit_data)//senddatathroughsci
{
while(SCI0SR1_TC!=1);
while(SCI0SR1_TDRE!=1);
SCI0DRL=transmit_data;
}
/*****************************************************************************
***/
/*----------------------------------------------------------------------------*\
abs_sub
\*----------------------------------------------------------------------------*/
unsignedcharabs_sub(unsignedcharnum1,unsignedcharnum2)
{unsignedchardifference;
if(num1>=num2){
difference=num1-num2;
}else{
difference=num2-num1;
}
returndifference;
}
voidpwm_set(unsignedintdutycycle)
{
PWMDTY1=dutycycle&0x00FF;
PWMDTY0=dutycycle>>8;
}
voidget_black_wire(void)//usedtoextractblackwire
{unsignedchari;
for(row=0;row<ROW_MAX;row++){
for(line=LINE_MIN;line<LINE_MAX-3;line++){
if(image_data[row][line]>image_data[row][line+3]+VALVE){
for(i=3;i<10;i++){
if(image_data[row][line+i]+VALVE<image_data[row][line+i+3]){
black_x[row]=line+i/2+2;
i=10;
}
}
line=LINE_MAX;
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 涂料购销合同模板常用版2篇
- 脚手架设计及计算
- 健康促进区县课件
- 2025西昌民族幼儿师范高等专科学校辅导员考试试题及答案
- 2025西安城市建设职业学院辅导员考试试题及答案
- 2025贵州装备制造职业学院辅导员考试试题及答案
- 2025皖南医学院辅导员考试试题及答案
- 2025绍兴文理学院辅导员考试试题及答案
- 设计企业核心竞争力构建路径
- 妊娠合并宫颈疾病诊疗规范
- 2024淮安市专业技术人员继续教育试题参考答案
- 2025年北京市朝阳区高三二模考试语文试卷(含答案)
- 2025年安徽省合肥市(合肥一中)三模(五月)生物试卷及答案
- 2025年中考第一次模拟考试卷:生物(广西卷)(解析版)
- 2025年公路水运工程重大事故隐患判定标准深度解析
- 2025届江西省上饶市高三下学期二模英语试题(原卷版+解析版)
- 《ISO 37001-2025反贿赂管理体系要求及使用指南》专业解读和应用培训指导材料之7:9绩效评价(雷泽佳编制-2025A0)
- 湖北省武汉市2025年高三3月份模拟考试英语试题含答案
- 机动车检测维修专业技术人员职业资格2024年笔试考试模拟题
- 钢结构吊装监理实施细则
- “住改商”登记利害关系业主同意证明(参考样本)
评论
0/150
提交评论