求飞思卡尔智能车摄像头组(k60)今年的完整程序。。。

求飞思卡尔智能车摄像头组(k60)今年的完整程序。。。,第1张

今年的没有,我有去年的,可以给你,摄像头组主要还是分为几部分,摄像头采集,图像处理,舵机控制,速度控制,就算我把整套程序给你,在你的车上估计也跑步起来,这程序都是有针对性的,比如前瞻,舵机中值还有以下其他的控制细节,建议你去论坛上看一下,http://www.znczz.com/,看看一些有关的东西,一部分一部分开始,不过人家有今年的程序,又有谁愿意给你呢,慢慢来吧少年!

Main.c

#include <hidef.h> /* common defines and macros */

#include <mc9s12db128.h>/* derivative information */

#pragma LINK_INFO DERIVATIVE "mc9s12db128b"

#include "define.h"

#include "init.h"

// variable used in video process

volatile unsigned char image_data[ROW_MAX][LINE_MAX] // data array of picture

unsigned char black_x[ROW_MAX]// 0ne-dimensional array

unsigned char row // x-position of the array

unsigned char line // y-position of the array

unsigned int row_count // row counter

unsigned char line_sample// used to counter in AD

unsigned char row_image

unsigned char line_temp // temperary variable used in data transfer

unsigned char sample_data[LINE_MAX] // used to save one-dimension array got in

interruption

// variables below are used in speed measure

Unsigned char pulse[5] // used to save data in PA process

Unsigned char counter // temporary counter in Speed detect

Unsigned char cur_speed // current speed

short stand

short data

unsigned char curve // valve used to decide straight or turn

short Bounds(short data)

short FuzzyLogic(short stand)

/*----------------------------------------------------------------------------*\

receive_sci

\*----------------------------------------------------------------------------*/

unsigned char receive_sci(void) // receive data through sci

{ unsigned char sci_data

while(SCI0SR1_RDRF!=1)

sci_data=SCI0DRL

return sci_data

}

/*----------------------------------------------------------------------------*\

transmit_sci

\*----------------------------------------------------------------------------*/

void transmit_sci(unsigned char transmit_data) // send data through sci

{

while(SCI0SR1_TC!=1)

while(SCI0SR1_TDRE!=1)

SCI0DRL=transmit_data

}

/*****************************************************************************

***/

/*----------------------------------------------------------------------------*\

abs_sub

\*----------------------------------------------------------------------------*/

unsigned char abs_sub(unsigned char num1, unsigned char num2)

{ unsigned char difference

if(num1>=num2){

difference=num1-num2

}else{

difference=num2-num1

}

return difference

}

void pwm_set(unsigned int dutycycle)

{

PWMDTY1=dutycycle&0x00FF

PWMDTY0=dutycycle>>8

}

void get_black_wire(void)// used to extract black wire

{ unsigned char i

for(row=0row<ROW_MAXrow++){

for(line=LINE_MINline<LINE_MAX-3line++){

if(image_data[row][line]>image_data[row][line+3]+VALVE){

for(i=3i<10i++){

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

} else{

//black_x[row]=(black_x[row]/45)*78

}

}

}

}

/*----------------------------------------------------------------------------*\

这是第一届上海交通大学CyberSmart技术报告里面的.

智能车论坛里有很多.


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/11361774.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-15
下一篇 2023-05-15

发表评论

登录后才能评论

评论列表(0条)

保存