資源簡介
四旋翼飛行器 飛控程序源碼
基于MK項目,經實踐檢驗

代碼片段和文件信息
/******************************************************************************/
/*?flight_ctrl.c:?????????????????????????????????????????????????????????????*/
/******************************************************************************/
/*?This?file?is?part?of?the?uVision/ARM?development?tools.????????????????????*/
/*?Copyright?(c)?2005-2006?Keil?Software.?All?rights?reserved.????????????????*/
/*?This?software?may?only?be?used?under?the?terms?of?a?valid?current????????*/
/*?end?user?licence?from?KEIL?for?a?compatible?version?of?KEIL?software???????*/
/*?development?tools.?Nothing?else?gives?you?the?right?to?use?this?software.??*/
/******************************************************************************/
#include?????????????????/*?prototype?declarations?for?I/O?functions?*/
#include?“general.h“ ??//general?header?file
#include?“flight_ctrl.h“
#include?“ppm_io.h“
axis_t?roll;
axis_t?pitch;
axis_t?yam;
axis_thr_t?thr;
motor_t?motor;
short?int?flying?=?0; ?//?the?QuadroCopter?flying?flag
short?int?buzzer_free; ?//?buzzer?is?not?busy
float?temp; ?//temp
float?tempa[3];
void?buzzer?(short?int?cycle?float?duty?short?int?times?);
void?led_green?(short?int?cycle?float?duty?short?int?times?);
void?led_red?(short?int?cycle?float?duty?short?int?times?);
void?parameter_init?(void);
/****************/
/*?main?program?*/
/****************/
int?main?(void)??{????????????????/*?execution?starts?here????????????????????*/
???short?int?thr_guard_count?=?0; ?//?for?throttle?safety?check
???short?int?ppm_count?=?0; ?//?for?Radio?Controller?safety?check
???short?int?battery_count?=?0;
???float?thr_dec?=?0; ?//?Throttle?decrease?while?battery?is?low
???
???int?i;
???PINSEL0?=?0x0AF00205; ????//?Enable?RxD0?and?TxD0?;Enable?CAP0.1???????*/
???PINSEL1?=?0x003FF280; //?Enable?A/D0~4?&?A/D6~7; MAT1.0~1.3 ?*/
???IODIR???=?0x0000C0E1; //?P0.14:?LED?red?;?p0.15:?LED?green;?p0.7:?Buzzer?output
???IOSET???=?1?<5;????????????//?set?the?sensitivity?of?accelerometer?to?2g
???IOSET???=?LED_RED;
???IOCLR???=?LED_GREEN; //?LED?red?on
???for?(?i?=?0;?i?0x00ffffff;?i?++?); ??//?delay?for?safety???
???VICIntEnClr??=?0xFFFFFFFF; //?Disable?all?the?interrupt
???VICVectAddr?=?0; //?Acknowledge?Interrupt
???parameter_init?(?);
???com_initialize?(?);????????????/*?init?interrupt?driven?serial?I/O?*/
???ppm_io_init?(?); //?initialize?PPM?I/O?function
???sensor_init?(?); //?initialize?sensors
???pid_init?(?); //?initialize?pid
??
//********************************************************************************
//Main?Loop
//********************************************************************************
while?(?1?)??{
??????
???if?(?timeSlot?==?0?)??{
??timeSlot?=?10; ??//?totally?20ms
//??????get_ppm_value??(?); ??//?get?ppm?input?true?values
//??????get_sensor_value?(?);
?????
//?flying?start?when?the?throttle?above?THR
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????9641??2009-01-22?13:06??FlightCtrl?V0.21\flight_ctrl.c
?????文件????????339??2009-01-02?11:50??FlightCtrl?V0.21\flight_ctrl.h
?????文件???????3786??2009-01-22?13:16??FlightCtrl?V0.21\flight_ctrl.Opt
?????文件???????2825??2008-12-26?19:37??FlightCtrl?V0.21\flight_ctrl.Uv2
?????文件???????3782??2009-01-07?15:02??FlightCtrl?V0.21\flight_ctrl_Opt.Bak
?????文件???????2688??2009-01-22?13:06??FlightCtrl?V0.21\flight_ctrl_Target?1.dep
?????文件???????2852??2008-12-23?01:24??FlightCtrl?V0.21\flight_ctrl_Uv2.Bak
?????文件???????2129??2009-01-06?21:22??FlightCtrl?V0.21\general.h
?????文件???????8450??2009-01-06?21:52??FlightCtrl?V0.21\menu.c
?????文件??????????2??2008-12-22?11:42??FlightCtrl?V0.21\menu.h
?????文件?????????19??2009-01-07?14:42??FlightCtrl?V0.21\ob
?????文件??????15341??2009-01-22?13:06??FlightCtrl?V0.21\ob
?????文件????????266??2009-01-22?13:06??FlightCtrl?V0.21\ob
?????文件??????32320??2009-01-22?13:06??FlightCtrl?V0.21\ob
?????文件??????15518??2009-01-22?13:06??FlightCtrl?V0.21\ob
?????文件????????231??2009-01-22?13:06??FlightCtrl?V0.21\ob
?????文件??????31904??2009-01-22?13:06??FlightCtrl?V0.21\ob
?????文件???????8942??2009-01-22?13:06??FlightCtrl?V0.21\ob
?????文件????????128??2009-01-22?13:06??FlightCtrl?V0.21\ob
?????文件??????22908??2009-01-22?13:06??FlightCtrl?V0.21\ob
?????文件??????76300??2009-01-22?13:06??FlightCtrl?V0.21\ob
?????文件??????90539??2009-01-22?13:06??FlightCtrl?V0.21\ob
?????文件????????448??2009-01-22?13:06??FlightCtrl?V0.21\ob
?????文件?????126500??2009-01-22?13:06??FlightCtrl?V0.21\ob
?????文件????????548??2009-01-22?13:06??FlightCtrl?V0.21\ob
?????文件????????479??2008-12-06?01:48??FlightCtrl?V0.21\ob
?????文件???????1507??2009-01-22?13:06??FlightCtrl?V0.21\ob
?????文件???????9780??2009-01-22?13:06??FlightCtrl?V0.21\ob
?????文件????????146??2009-01-22?13:06??FlightCtrl?V0.21\ob
?????文件??????26256??2009-01-22?13:06??FlightCtrl?V0.21\ob
............此處省略37個文件信息
評論
共有 條評論