freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

基于51單片機多模式智能小車研究與制作-資料下載頁

2025-06-24 04:21本頁面
  

【正文】 }/***外部中斷0初始化***/void int0init(){ IT0=1。 EX0=1。 EA=1。 Motor_ENA=0。 Motor_ENB=0。 LED1=1。 LED2=1。 LED3=1。 flag_xunji=0。 flag_hongwai=0。 flag_lanya=0。}/***串口初始化***/void chuan_init(void){ SCON=0x50。 //串行1,工作方式1,8位數(shù)據(jù)的UART,BAUD可變,允許串行接收數(shù)據(jù) BRT=0xfd。 //BAUD=9600bps 常數(shù) PCONamp。=0x3f。 //各種工作方式BAUD不加倍 AUXR=0x11。 //允許獨立BAUD發(fā)生器允許,每12個時鐘計數(shù)一次,并開始計數(shù) ES=1。 EA=1。}/***紅外遙控解碼,并將其放在ircode【】數(shù)組里面***/void irpros(){ uchar k,i,j。 uchar value。 k=1。 for(j=0。j4。j++) { for(i=0。i8。i++) { value=value1。 //7 if(irdata[k]6) //8 { value=value | 0x80。 } k++。 } ircode[j]=value。 } irprosok=1。}/***循跡采集判斷與速度處理***/void Tracking_Collect() //循跡采集函數(shù){ uchar Tracking_Collect。 Tracking_Collect=P0amp。0x0f。 switch(Tracking_Collect) { case 0: //00 00 Right_Pwm_Num=70。 //右輪(直線前進) Left_Pwm_Num=70。 //左輪 Car_line()。 break。 case 1: //00 01 Left_Pwm_Num=64。 //左輪(大左轉(zhuǎn)) Right_Pwm_Num=65。 //右輪 Car_Right_bend()。 break。 case 2: //00 10 Left_Pwm_Num=64。 //左輪(小左轉(zhuǎn)) Right_Pwm_Num=65。 //右輪 Car_line()。 break。 case 3: //00 11 Left_Pwm_Num=62。 //左輪(中左轉(zhuǎn)) Right_Pwm_Num=65。 //右輪 Car_Right_bend()。 break。 case 4: //01 00 Right_Pwm_Num=64。 //右輪(小右轉(zhuǎn)) Left_Pwm_Num=65。 //左輪 Car_line()。 break。 case 8: //10 00 Right_Pwm_Num=64。 //右輪(大右轉(zhuǎn)) Left_Pwm_Num=65。 //左輪 Car_Left_bend()。 break。 case 12: //11 00 Right_Pwm_Num=62。 //右輪(中右轉(zhuǎn)) Left_Pwm_Num=65。 //左輪 Car_Left_bend()。 break。 case 15: //11 11 //停車 Motor_Stop()。 break。 default:break。 }} /***TC9012紅外遙控處理***/void IR_dispose(){ bianma_add=ircode[3]+ircode[2]*256+ircode[1]*65536+ircode[0]*65536*65536。 bianma_kaishi=bianma_start_1+bianma_start_2*256+bianma_start_3*65536+bianma_start_4*65536*65536。 bianma_tingzhi=bianma_stop_1+bianma_stop_2*256+bianma_stop_3*65536+bianma_stop_4*65536*65536。 bianma_qianjin=bianma_1+bianma_2*256+bianma_3*65536+bianma_4*65536*65536。 bianma_houtui=bianma_5+bianma_6*256+bianma_7*65536+bianma_8*65536*65536。 bianma_zuo=bianma_9+bianma_10*256+bianma_11*65536+bianma_12*65536*65536。 bianma_you=bianma_13+bianma_14*256+bianma_15*65536+bianma_16*65536*65536。 if(bianma_add==bianma_kaishi) { Motor_Start()。 //啟動功能 } else if(bianma_add==bianma_tingzhi) { Motor_Stop()。 //停止功能 } else if(bianma_add==bianma_qianjin) //前進功能 { Right_Pwm_Num=70。 Left_Pwm_Num=70。 Motor_Input_1=0。 Motor_Input_2=1。 Motor_Input_3=0。 Motor_Input_4=1。 } else if(bianma_add==bianma_houtui) //后退功能 { Right_Pwm_Num=70。 Left_Pwm_Num=70。 Motor_Input_1=1。 Motor_Input_2=0。 Motor_Input_3=1。 Motor_Input_4=0。 } else if(bianma_add==bianma_zuo) //左拐功能 { Right_Pwm_Num=60。 Left_Pwm_Num=20。 Motor_Input_1=0。 Motor_Input_2=1。 Motor_Input_3=0。 Motor_Input_4=1。 } else if (bianma_add==bianma_you) //右拐功能 { Right_Pwm_Num=20。 Left_Pwm_Num=60。 Motor_Input_1=0。 Motor_Input_2=1。 Motor_Input_3=0。 Motor_Input_4=1。 }}/***藍牙收到數(shù)據(jù),并處理***/void Bluetooth(){ switch(aa) { case 1: //前進 Left_Pwm_Num=90。 //左輪(中左轉(zhuǎn)) Right_Pwm_Num=90。 //右輪 Motor_Input_1=0。 Motor_Input_2=1。 Motor_Input_3=0。 Motor_Input_4=1。 break。 case 2: //后退 Left_Pwm_Num=90。 //左輪(中左轉(zhuǎn)) Right_Pwm_Num=90。 //右輪 Motor_Input_1=1。 Motor_Input_2=0。 Motor_Input_3=1。 Motor_Input_4=0。 break。 case 3: //左拐 Left_Pwm_Num=20。 //左輪(中左轉(zhuǎn)) Right_Pwm_Num=60。 //右輪 Motor_Input_1=0。 Motor_Input_2=1。 Motor_Input_3=0。 Motor_Input_4=1。 break。 case 4: //右拐 Left_Pwm_Num=60。 //左輪(中左轉(zhuǎn)) Right_Pwm_Num=20。 //右輪 Motor_Input_1=0。 Motor_Input_2=1。 Motor_Input_3=0。 Motor_Input_4=1。 break。 case 5: //啟動 Motor_Start()。 break。 case 6: //停止 Motor_Stop()。 break。 }}/***安卓手機小車功能模式選擇***/void Phone_choose(){ if(aa==7) //循跡功能模式選擇 { flag_xunji=1。 flag_hongwai=0。 flag_lanya=0。 } if(aa==8) //紅外功能模式選擇 { Motor_Stop()。 flag_xunji=0。 flag_hongwai=1。 flag_lanya=0。 } if(aa==9) //藍牙功能模式選擇 { flag_xunji=0。 flag_hongwai=0。 flag_lanya=1。 }}/***電機啟動函數(shù)***/void Motor_Start(){ Motor_ENA=1。 Motor_ENB=1。 TR1=1。}/***電機停止函數(shù)***/void Motor_Stop(){ Motor_ENA=0。 Motor_ENB=0。 TR1=0。}/***********以下就是小車循跡算法*************//***小車直線前進***/void Car_line(){ Motor_Input_1=0。 Motor_Input_2=1。 Motor_Input_3=0。 Motor_Input_4=1。}/***小車向右(中拐彎)大拐彎***/void Car_Right_bend(){ Motor_Input_1=0。 Motor_Input_2=1。 Motor_Input_3=1。 Motor_Input_4=0。}/***小車向左(中拐彎)大拐彎***/void Car_Left_bend(){ Motor_Input_1=1。 Motor_Input_2=0。 Motor_Input_3=0。 Motor_Input_4=1。}/***定時器0中斷處理函數(shù)【TC9012紅外遙控】***/void timer0() interrupt 1{ irtime++。 //255}/***外部中斷0處理函數(shù)***/void init0() interrupt 0{ if(startflag) { if(irtime32) //檢查引導(dǎo)碼 { bitnum=0。 } irdata[bitnum]=irtime。 irtime=0。 bitnum++。 if(bitnum==33) { bitnum=0。 irreceok=1。 } } else { startflag=1。 irtime=0。 }}/***定時器1中斷處理函數(shù)【電機的PWM產(chǎn)生】***/void T1_time() interrupt 3{ uint t0_count。 TH1=0xfc。 TL1=0x67。 t0_count++。 if(t0_countRight_Pwm_Num) { Motor_ENA=1。 } else { Motor_ENA=0。 } if(t0_countLeft_Pwm_Num) { Motor_ENB=1。 } else { Motor_ENB=0。 } if(t0_count100) { t0_count=0。 }}/***串口中斷處理函數(shù)***/void chuan_isr() interrupt 4{ if(RI==1) { RI=0。 aa=SBUF。 SBUF=39。T39。 }}/***延時函數(shù)***/void delay_1ms(uint z) //延時zms{ uint x,y。 for(x=z。x0。x) for(y=110。y0。y)。} 六、參考文獻[1] 胡峻魁、鄭勝文 HOLTEL 48單片機系列原理及
點擊復(fù)制文檔內(nèi)容
高考資料相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1