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

正文內容

基于51單片機多模式智能小車研究與制作-在線瀏覽

2024-08-04 04:21本頁面
  

【正文】 otor_Input_1=p2^0。 sbit Motor_Input_3=p2^2。sbit Motor_ENA=p2^4。/***循跡輸入引腳定義***///sbit Tracking_Input_1=p0^0。//sbit Tracking_Input_3=p0^2。/***操作按鍵定義***/sbit Motor_start=p3^0。/***分支函數的聲明***/void init()。 void Car_line()。void Motor_Start()。void Car_Left_bend()。 void delay_1ms(uint z)。/***主函數***/void main(){ init()。 Motor_ENB=0。 Tracking_Collect()。 }}/***定時器0初始化***/void init(){ TMOD=0x10。 //定時時間為1ms,初值為65536921, TL1=0x67。 ET1=1。 Tracking_Collect=P0amp。 switch(Tracking_Collect) { case 0: //00 00 Right_Pwm_Num=70。 //左輪 Car_line()。 case 1: //00 01 Left_Pwm_Num=30。 //右輪 Car_Right_bend()。 case 2: //00 10 Left_Pwm_Num=65。 //右輪 Car_line()。 case 3: //00 11 Left_Pwm_Num=59。 //右輪 Car_Right_bend()。 case 4: //01 00 Right_Pwm_Num=65。 //左輪 Car_line()。 case 8: //10 00 Right_Pwm_Num=30。 //左輪 Car_Left_bend()。 case 12: //11 00 Right_Pwm_Num=59。 //左輪 Car_Left_bend()。 case 15: //11 11 //停車 flag_Buzzer=1。 break。 }}/***電機開始***/void Motor_Start(){ Motor_ENA=1。 TR1=1。 Motor_ENB=0。}/***功能按鍵掃描函數***/void keyscan(){ if(Motor_start==0) { delay_1ms(5)。 } } if(Motor_stop==0) { delay_1ms(5)。 } }}/***********以下就是小車循跡算法*************//***小車直線前進***/void Car_line(){ Motor_Input_1=0。 Motor_Input_3=0。}/***小車向右(中拐彎)大拐彎***/void Car_Right_bend(){ Motor_Input_1=0。 Motor_Input_3=1。}/***小車向左(中拐彎)大拐彎***/void Car_Left_bend(){ Motor_Input_1=1。 Motor_Input_3=0。}/***蜂鳴器函數***/void Buzzer_sound(){ unsigned char Buzzer_num。 for(Buzzer_num=0。Buzzer_num++) { Buzzer=0。 Buzzer=1。 TH1=0xfc。 t0_count++。 } else { Motor_ENA=0。 } else { Motor_ENB=0。 }}/***軟件延時zms***/void delay_1ms(uint z){ uint x,y。x0。y0。}(2):TC9012紅外遙控程序控制流程圖及程序代碼 /***測試:成功***/ /***智能小車c語言程序代碼**/ /*******CH:00FF45BA CH: 00FF46B9 CH+:00FF47B8*******/ /*******|:00FF44BB |:00FF40BF ||:00FF43BC************//******* :00FF07F8 +: 00FF15EA EQ:00FF09F6*********/ /******* 0:00FF16E9 100+:00FF19E6 200+:00FF0BF2********/ /******* 1:00FF0CF3 2:00FF18E7 3:00FF5EA1************/ /******* 4:00FF08F7 5:00FF1CE3 6:00FF5AA5***********/ /******* 7:00FF42BD 8:00FF52AD 9:00FF4AB5**********/include /***宏定義***/define uint unsigned int define uchar unsigned char /***特殊功能寄存器定義***/sfr p0=0x80。sfr p2=0xA0。/***全局變量定義***/uchar Right_Pwm_Num。 //左輪脈沖變量long bianma_kaishi,bianma_tingzhi,bianma_qianjin,bianma_houtui。uchar irtime。uchar irdata[33]。uchar irreceok。uchar irprosok。sbit LED2=P3^5。sbit LED4=P3^7。 sbit Motor_Input_2=p2^1。sbit Motor_Input_4=p2^3。sbit Motor_ENB=p2^5。 // *1uchar bianma_start_2=0x45。 // *65536uchar bianma_start_4=0x00。 // *1uchar bianma_stop_2=0x47。 // *65536uchar bianma_stop_4=0x00。 // *1uchar bianma_2=0x18。 // *65536uchar bianma_4=0x00。 // *1uchar bianma_6=0x52。 // *65536uchar bianma_8=0x00。 // *1uchar bianma_10=0x08。 // *65536uchar bianma_12=0x00。 // *1uchar bianma_14=0x5A。 // *65536uchar bianma_16=0x00。 void int0init()。 void Motor_Stop()。void Motor_Start()。/***主函數***/void main(){ timerinit()。 Motor_ENA=0。 while(1) { if(irreceok) { irpros()。 } if(irprosok) { irprosok=0。 //TC9012紅外遙控處理函數調用 }}/***定時器0和定時器1初始化***/void timerinit(){ TMOD=0x12。 TL0=0x00。 //定時時間為1ms,初值為65536921, TL1=0x67。 ET0=1。 TR0=1。 EX0=1。}/***紅外遙控解碼,并將其放在ircode【】數組里面***/void irpros(){ uchar k,i,j。 k=1。j4。i8。 //7 if(irdata[k]6) //8 { value=value | 0x80。 } ircode[j]=value。} /***TC9012紅外遙控處理***/void IR_dispose(){ bianma_add=ircode[3]+ircode[2]*256+ircode[1]*65536+ircode[0]*65536*65536。 bianma_tingzhi=bianma_stop_1+bianma_stop_2*256+bianma_stop_3*65536+bianma_stop_4*65536*65536。 bianma_houtui=bianma_5+bianma_6*256+bianma_7*65536+bianma_8*65536*65536。 bianma_you=bianma_13+bianma_14*256+bianma_15*65536+bianma_16*65536*65536。 //啟動功能 } else if(bianma_add==bianma_tingzhi) { Motor_stop()。 Left_Pwm_Num=70。 Motor_Input_2=1。 Motor_Input_4=1。 Left_Pwm_Num=70。 Motor_Input_2=0。 Motor_Input_4=0。 Left_Pwm_Num=20。 Motor_Input_2=1。 Motor_Input_4=1。 Left_Pwm_Num=60。 Motor_Input_2=1。 Motor_Input_4=1。 Motor_ENB=1。}/***電機停止函數***/void Motor_Stop(){ Motor_ENA=0。 TR1=0。 //255}/***外部中斷0處理函數***/void init0() interrupt 0{ if(startflag) { if(irtime32) //檢查引導碼 { bitnum=0。 irtime=0。 if(bitnum==33) { bitnum=0。 } } else { startflag=1。 }}/***定時器1中斷處理函數【電機的PWM產生】***/void T1_time() interrupt 3{ uint t0_count。 TL1=0x67。 if(t0_countRight_Pwm_Num) { Motor_ENA=1。 } if(t0_countLeft_Pwm_Num) { Motor_ENB=1。 } if(t0_count100) { t0_count=0。 for(x=z。x) for(y=110。y)。sfr p1=0x90。sfr p3=0xB0。 sbit Motor_Input_2=p2^1。sbit Motor_Input_4=p2^3。sbit Motor_ENB=p2^5。uchar Right_Pwm_Num。 //左輪脈沖變量/***函數聲明***/void init()。void Motor_Stop()。 //串行初始化void Bluetooth()。/***主函數***/void main(){ init()。 while(1) { Bluetooth()。 Motor_ENB=1。}/***電機停止函數***/void Motor_Stop(){ Motor_ENA=0。 TR1=0。 TH1=0xfc。 EA=1。}/***串口初始化***/void chuan_init(void){ SCON=0x50。 //BAUD=9600bps 常數 PCONamp。 //各種工作方式BAUD不加倍 AUXR=0x11。 EA=1。 aa=SBUF。T39。 Left_Pwm_Num=90。 //右輪 Motor_Input_1=0。 Motor_Input_3=0。 break。 Left_Pwm_Num=90。 //右輪 Motor_Input_1=1。 Motor_Input_3=1。 break。 Left_Pwm_Num=20。 //右輪 Motor_Input_1=0。 Motor_Input_3=0。 break。 Left_Pwm_Num=60。 //右輪 Motor_Input_1=0。
點擊復制文檔內容
高考資料相關推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1