Mundarija:
- 1 -qadam: Loyihani loyihalash
- 2 -qadam: Qurilmalar va komponentlarni tanlang
- 3 -qadam: Mikrokontroller
- 4 -qadam: Kompyuter dasturini yozing
- 5 -qadam: tanani qurish
- 6 -qadam: Simsiz davrni yarating
- 7 -qadam: integratsiya
- 8 -qadam: Mikrokontroller dastur kodi
Video: Qoya: 8 qadam
2024 Muallif: John Day | [email protected]. Oxirgi o'zgartirilgan: 2024-01-30 13:29
Bu robot vizual asosiy dastur tomonidan boshqariladi (ketma -ket port orqali) va PIC mikrokontroller (16F877) tomonidan ishlab chiqarilgan puls kengligi modulyatsiyalangan (PWM) signal orqali uch xil tezlikda harakatlanishi mumkin. Robot ikki rejimda ishlashi mumkin: "oddiy boshqaruv" va "yorug'lik kuzatuvchisi". Oddiy boshqaruv rejimida, robot 3 m dan 18 sm gacha bo'lgan narsalarni 150 m masofada boshqa joydan boshqa joyga ko'chirishi mumkin. Holbuki, yorug'lik kuzatuvchisi rejimida, u qorong'i xonadagi yorug'likni kuzatadi, yorug'lik sensori kabi ko'plab sensorlar ishlatilgan; egilish sensori, to'xtash joyi oqimi, batareya zaryadini o'lchash va qo'lda ishlatiladigan ba'zi chegara kalitlari va sensorli sensorlar. U tepalikka chiqqanda tezligini bir xil ushlab turishi mumkin va qorong'i qorong'i tushganda avtomatik ravishda chiroqni yoqadi. Shuningdek, IC -ning xavfsizligini ta'minlash uchun u qotib qolganda tokni uzadi va biror narsani ushlab turganda qo'l to'xtaydi. 4 DC motorlar PIC mikrokontroller 16F877 va 3 dvigatelli haydovchi davrlari tomonidan boshqarilgan. Taxminan 4 oy davom etdi va taxminan 600 dollar turadi.
1 -qadam: Loyihani loyihalash
Dastlabki bosqichda loyihaning dizayni taqdim etildi. asosan, blok -sxemani aniqlash; rasmga qarang.
Bu bosqichda batafsilroq O'chirish diagrammasi talab qilinadi, lekin buni osonlashtirish uchun quyidagi asosiy modullar aniqlandi: 1. Mikrokontroller 2. Datchiklar 3. Dvigatellar 4. Simsiz elektron 5. Kompyuter dasturi. 3D dizayn ham qilingan, rasmga qarang.
2 -qadam: Qurilmalar va komponentlarni tanlang
Ushbu bosqichda dizayner robotni yaratish uchun zarur bo'lgan qurilmalar va komponentlarni tanlashi kerak.
Bunga quyidagilar kiradi: simsiz zanjir (MAX232, LM331, FM uzatuvchi va qabul qilgich modullari), motorlar (4 ta doimiy dvigatel), dvigatellar haydovchilari davri (H-ko'prigi), PIC mikrokontroller (16F877), batareya, kuchlanish regulyatorlari (MC7805), mikrosxemalar., Fotoresistorlar, Tilt sensori … va hokazo. Bu qurilmalarning hisob -kitob qilish qobiliyatini va ular qanday ishlashini tushunish kerak.
3 -qadam: Mikrokontroller
Bu qadam eng muhim qadamdir. boshida PICdan olinadigan va uzatiladigan kodlar aniqlanishi kerak.
Komponentlarni PIC mos keladigan pinlariga ulashni boshlang va mikrokontrollerni dasturlang. Buning uchun regulyatorlar, rezistorlar, sensorlar va boshqalardan foydalangan holda kichik zanjirlar qurilishi talab qilinishi mumkin.
4 -qadam: Kompyuter dasturini yozing
Dastur vizual asosda yozilgan.
Aloqa RS-232 orqali o'rnatildi. Sozlamalarni (port raqami, uzatish tezligi, ma'lumotlar bitlarining paritet soni, to'xtash bitlari) sozlash orqali ma'lumotlarni mikrokontrollerga yuborish uchun MSComm -dan foydalanish. Men 8 bitli ma'lumotlarni bir to'xtash biti va paritet tezligida 9600 bps tezlikda ishlatardim.
5 -qadam: tanani qurish
Tananing yaxshi dizayni muhim ahamiyatga ega. Shuningdek, g'ildirak tartibini tanlash uchun rasmga qarang.
u robot dasturlarning yaxshi ishlashini kafolatlagandan so'ng qurilgan. Bu qadam dasturlashdan oldin ham amalga oshirilishi mumkin.
6 -qadam: Simsiz davrni yarating
Simsiz kontaktlarning zanglashiga olib kelishi mustaqil bo'lishi mumkin. Dastlabki bosqichda men kompyuterni robot bilan ulash uchun simdan foydalandim va robotni tugatgandan so'ng, simsiz aloqa tizimi birlashtirildi.
7 -qadam: integratsiya
Biz komponentlarni birlashtirgan va robotni sinovdan o'tkazgan payt.
8 -qadam: Mikrokontroller dastur kodi
; *************** FINAL ******************************** ro'yxati p = 16f877 "radius" dezidloklarni o'z ichiga oladi << 8 | "1"; Versiya raqami konfiguratsiya _CP_OFF & _PWRTE_OFF & _WDT_OFF & _XT_OSC; ********** asosiy o'zgaruvchi ************************* cblock 0x20; boshlanishi bank 0 ram maydoni INPUT_VAR L1 L2 X SPEED11 SPEED12 SPEED21 SPEED22 MSTOP LDET LR1 LR2 endc; ********** asosiy dasturning boshlanishi *************** BSF boshlanishi STATUS, RP0 BCF STATUS, RP1 MOVLW 0X40 MOVWF ADCON1 MOVLW 0XFF; PORT A IS I MOVWF TRISA MOVLW 0X00; PORT B IS MOVWF TRISB MOVLW 0XF0; PORT C IS I/O MOVWW MOVWW TXX MOVF TRISD MOVLW 0X07; PORT E IS MOVWF TRISE BANKSEL OPTION_REG BCF OPTION_REG, T0CS BCF STATUS, RP1 BCF STATUS, RP0; ************************* ******************; ***************************** ************ BCF PORTB, 1 BCF PORTB, 2 BCF PORTB, 6 CALL PWM1OFF CALL PWM2OFF BCF PORTD, 0 BCF PORTD, 1 BCF PORTD, 2 BCF PORTD, 3 BTFSS LDET, 0 BCF kuting. PORTB, 7 MOVLW 0X00 MOVF MSTOP MOVF LDET BANKSEL INTCON BCF INTCON, GIE BANKSEL TXSTA BSF TXSTA, BRGH MOVLW 0X40 MOVWF SPBRG BCF TXSTA, SYNC BANKSF RST BST, OERR GOTO CLROE BANKSEL PIE1 BSF PIE1, RCIE BANKSEL RCSTA BCF RCSTA, RX9 BSF RCSTA, CRENWAIT1 BANKSEL PORTB BSF PORTB, 3 BSF PORTB, 4 BANFFT PSP1 PBT P1 cALL PWM1OFF cALL PWM2OFF cALL DarkLight BTFSC LDET, 0 BSF PORTB, 7RXDATA; BANKSEL RCSTA; BTFSC RCSTA, OERR; GOTO Bekatlar cALL PWM1OFF cALL PWM2OFF cALL DarkLight BTFSC LDET, 0 BSF PORTB, 7 BANKSEL PIR1 BCF PIR1, RCIF BANKSEL RCREG MOVF RCREG, 0; *****************************************; **** *********************************** MOVWF INPUT_VAR MOVLW 0X00 MOVWF RCREG BCF STATUS, RP0 BCF STATUS, RP1 MOVF INPUT_VAR, 0; STUB SUBLW 0X53 BTFSC STATUS, Z GOTO STOPPS MOVF INPUT_VAR, 0; SUBLW 0X4E BTFSC STATUS LIGHT, Z GOTO LON MOVF INPUFVVFVVFVVSVVSVOF SHOV, 1 LIGHT, 0; SUBLW SUBLW 0X66 BTFSC STATUS, Z GOTO FSLOW MOVF INPUT_VAR, 0; OLG'A YUQORI SUBLW 0X72 BTFSC STATUS, Z GOTO RSLOW MOVF INPUT_VAR, 0; MOVE LEV. X6C BTFSC STATUS, Z GOTO LSLOW MOVF INPUT_VAR, 0; BACKWARD SLOW SUBLW 0X62 BTFSC STATUS, Z GOTO BSLOW MOVF INPUT_VAR 0 STATUS, Z GOTO RMED MOVF INPUT_VAR, 0; SOL O'RTA SUBLW 0X4C BTFSC STATUS, Z GOTO LMED MOVF INPUT_VAR, 0; BACKWARD MEDIUM SUBLW 0X42 BTFTFTFOFFOV Z GOTO FFAST MOVF INPUT_VAR, 0; To'g'ri FAST SUBLW 0X57 BTFSC STATUS, Z GOTO RFAST MOVF INPUT_VAR 0 BFAST MOVF INPUT_VAR, 0; Qo'lni yopish SUBLW 0X43 BTFSC STATUS, Z GOTO HCLOSE MOVF INPUT_VAR 0 QO'LLANILGAN SUBLW 0X64 BTFSC STATUS, Z GOTO HDOWN MOVF INPUT_VAR, 0; LIGHT FOLOWE R SUBLW 0X54 BTFSC STATUS, Z GOTO LFOLLOW; ************************************ ***; ***************************************** GOTO CLROEFSLOW; BANKSEL RCSTA; BCF RCSTA, OERR; BCF RCSTA, CREN; NOP; BSF RCSTA, CREN BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP; BCF LDET, 0; BUTTLE DAVLO, BUTFAL DAVLO; LDET, 0; BSF PORTB, 7 NORMALSLOW MOVLW 0XFF MOVWF SPEED11 MOVLW 0X66 MOVWF SPEED12 MOVLW 0XFF MOVWF SPEED21 MOVLW 0X66 MOVWF SPEED21 MOVLW 0X66 MOVWF SPEED22 CALL PWF1 PWB 1 PWB PRL PWD, RCIF GOTO RXDATA GOTO REP3 GOTO CLROE; *********************************** ** LSLOW BCF STATUS, RP0 BCF STATUS, RP1; Call BUTTLEVEL; BTFSC MSTOP, 1; GOTO STOPPS MOVLW 0X00 MOVWF MSTOP BCF LDET, 0 CALL DARKLIGHT BTFSC LDET, 0; BSF MWFWW MOVFWOV 0XCF MOVWF SPEED21 MOVLW 0X66 MOVWF SPEED22 Qo'ng'iroq PWM1ON Qo'ng'iroq PWM2ON BSF PORTD, 0 BCF PORTD, 1 BSF PORTB, 1 BCF POR TB, 2 REP4 BANKSEL PIR1 BTFSC PIR1, RCIF GOTO RXDATA GOTO REP4 GOTO CLROE; ******************************* ********** RSLOW BCF STATUS, RP0 BCF STATUS, RP1; CALL BUTTLEVEL; BTFSC MSTOP, 1; GOTO STOPPS MOVLW 0X00 MOVWF MSTOP BCF LDET, 0 CALL DARKLIGHT BTFSC LDET, 0; 7 BSF PORTB. 0XCF MOVWF SPEED11 MOVLW 0X66 MOVWF SPEED12 MOVLW 0XFF MOVWF SPEED21 MOVLW 0X99 MOVWF SPEED22 CALL PWM1ON CALL PWM2ON BCF PORTD, 0 BSF PORTD, 1 BCF PFT PBB 1 PFT PBB, 1 BFF PBB **************************** BSLOW BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; BUTTLEVELga qo'ng'iroq qilish; BTFSC MSTOP, 1; GOTO STOPLAR DARKLIGHT BTFSC LDET, 0; BSF PORTB, 7 MOVLW 0XCF MOVWF SPEED11 MOVLW 0X99 MOVWF SPEED12 MOVLW 0XCF MOVWF SPEED21 MOVLW 0XCF PWF PWF PW2 PWF PORTB, 2 REP5 BANKSEL PIR1 BTFSC PIR1, RCIF GOTO RXDATA GOTO REP5 GOTO CLROE; ******************************* ********** F. MED BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; CUT BUTTLEVEL; BTFSC MSTOP, 1; GOTO STOP TO DARKLIGHT BTFSC LDET, 0; BSF PORTFF0 MOVFF 0, 0 MOVWF SPEED21 MOVLW 0X99 MOVWF SPEED22 CALL PWM1ON CALL PWM2ON BCF PORTD, 0 BCF PORTD, 1 BSF PORTB, 1 BSF PORTB, 2 CALL SDELAY REP6 CALL STALL1 BTFSC MSTOP, 0 GOTOSO BOSHQARMALARI GOTO REP6 PLUSEMED MOVLW 0XCF MOVWF SPEED11 MOVLW 0XCC MOVWF SPEED12 MOVLW 0XCF MOVWF SPEED21 MOVLW 0XCC MOVWF SPEED22 CALL PWM1ON CALL PWM2ON BCF PORT, 1 PFT PFD PFD 1 BANKSEL PIR1 BTFSC PIR1, RCIF GOTO RXDATA BTFSS PORTD, 7 GOTO NORMALMED GOTO REP7 GOTO CLROE; ******************************* ************ RMED BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; CUT BUTTLEVEL; BTFSC MSTOP, 1; GOTO STOPLAR DARKLIGHT BTFSC LDET, 0; BSF PORT B, 7 MOVLW 0XFF MOVWF SPEED11 MOVLW 0X99 MOVWF SPEED12 MOVLW 0XFF MOVWF SPEED21 MOVLW 0X66 MOVWF SPEED22 CALL PWM1ON CALL PWM2ON BCF PORTD, 0 BSF PORT PORT, 1 BCP PFT PDB 1, BTFSC PIR1, RCIF GOTO RXDATA GOTO REP8 GOTO CLROE; *********************************** **** LMED BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; CUT BUTTLEVEL; BTFSC MSTOP, 1; GOTO STOPLAR DARKLIGHT BTFSC LDET, 0; BSF PWWF MOVF, 6 MOVFWOV SPEED12 MOVLW 0XFF MOVWF SPEED21 MOVLW 0X99 MOVWF SPEED22 CHAQIRISH PWM1ON CHAQIRISH PWM2ON BSF PORTD, 0 BCF PORTD, 1 BSF PORTB, 1 BCF PORTB, 2 REP9; CALL STALL1; REP9 GOTO CLROE; ***************************************** BMED BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; BUTTLEVEL qo'ng'iroq qilish; BTFSC MSTOP, 1; GOTO STOPLAR DARKLIGHT BTFSC LDET, 0; BSF PORTB, 7 MOVLW 0XFF MOVWW MOVLW 0X7F MOVWF SPEED12 MOVLW 0XFF MOVWF SPEED21 MOVLW 0X7F MOVWF SPEED22 CALL PWM1ON CALL PWM2ON BSF PORTD, 0 BSF PORTD, 1 BCF PORTB, 1 BCF PTB, 1 PTT, 1 PTS, PDP, PTS, 2 PTT REP10 GOTO CLROE; ***************************************** FFAST BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0 BSF MSTOP, 4; CUT BUTTLEVEL; BTFSC MSTOP, 1; GOTO STOPPS DARKLIGHT BTFSC LDET; MOVWF SPEED21 MOVLW 0X7F MOVWF SPEED22 cALL PWM1ON cALL PWM2ON BCF PORTD, 0 BCF PORTD, 1 BSF PORTB, 1 BSF PORTB, 2 cALL SDELAY NORMALFAST MOVLW 0XCF MOVWF SPEED11 MOVLW 0XCC MOVWF SPEED12 MOVLW 0XCF MOVWF SPEED21 MOVLW 0XCC MOVWF SPEED22 cALL PWM1ON QO'NG'IROQ PWM2ON BCF PORTD, 0 BCF PORTD, 1 BTFSC LDET, 0 BSF PORTB, 7 BSF PORTB, 1 BSF PORTB, 2 REP11 CALL STALL1 BTFSC MSTOP, 0 GOTO STOPS BANKSEL PIR1 BTFSC PIR1, RCIF GOTO ROTFOTO RXDATS NOP 11 AST MOVLW 0XCF MOVWF SPEED11 MOVLW 0XFF MOVWF SPEED12 MOVLW 0XCF MOVWF SPEED21 MOVLW 0XFF MOVWF SPEED22 CALL PWM1ON CALL PWM2ON BCF PORTD, 0 BCF PBT 1 PBB PBB 1 PSB, RCIF GOTO RXDATA BTFSS PORTD, 7 GOTO NORMALFAST GOTO REP12 GOTO CLROE; ********************************* ******** RFAST BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; CALL BUTTLEVEL; BTFSC MSTOP, 1; GOTO STOPLAR DARKLIGHT BTFSC LDET, 0; BSF PWW, 7 BFF POV, SPEED11 MOVLW 0X99 MOVWF SPEED12 MOVLW 0XFF MOVWF SPEED21 MOVLW 0X66 MOVWF SPEED22 CALL PWM1ON CHAQIRISH PWM2ON BCF PORTD, 0 BSF PORTD, 1 BCF PORTB, 1 BSF PBT PBT PTB 1 PFT PBT GOTO REP13 GOTO CLROE; ***************************************** LFAST BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; BUTTLEVELga qo'ng'iroq qilish; BTFSC MSTOP, 1; GOTO STOPLAR DARKLIGHT BTFSC LDET, 0; BSF PORTB, 7 MOVLW 0xff MOVWF SPEED11 MOVLW 0X66 MOVWF SPEED12 MOVLW 0xff MOVWF SPEED21 MOVLW 0X99 MOVWF SPEED22 CALL PWM1ON CALL PWM2ON BSF PORTD, 0 BCF PORTD, 1 BSF PORTB, 1 BCF PORTB, 2 CALL SDELAY MOVLW 0xff MOVWF SPEED11 MOVLW 0X4C MOVWF SPEED12 MOVLW 0XEF MOVWF SPEED21 MOVLW 0XB3 MOVWF SPEED22 CHAQIRISH PWM1ON CHAQIRISH PWM2ON BSF PORTD, 0 BCF PORTD, 1 BSF PORTB, 1 BCF PORTB, 2 REP14 CALL STALL1 BTFSC MSTOP, 0 GOTO GOTO GOTO BOSHQARO1 ************************************** BFAST BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; QO'NG'IROQ BUTTLEVEL; BTFSC MSTOP, 1; GOTO STOP TO CALL DARKLIGHT BTFSC LDET, 0; BSF PORTB, 7 MOVLW 0XDF MOVWF SPEWW MOVWEF MOVLOV PWM2ON BSF PORTD, 0 BSF PORTD, 1 BCF PORTB, 1 BCF PORTB, 2 CALL SDELAY MOVLW 0XEF MOVWF SPEED11 MOVLW 0X66 MOVWF SPEED12 MOVLW 0XEF MOVWF SPEED21 MOVLWW PWW2 PWW2 PORTD, 0 BSF PORTD, 1 BCF PORTB, 1 BCF PORTB, 1 BCF PORTB, 2 REP15 CALL STALL1 BTFSC MSTOP, 0 GOTO STOP BANKSEL PIR1 BTFSC PIR1, RCIF GOTO RXDATA GOTO REP15 GOTO CLROE; ************* ****************************** BCF STATUSINI, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; BUTTLEVEL ga qo'ng'iroq qiling; BTFSC MSTOP, 1; GOTO STOPS CALL DARKLIGHT BTFSC LDET, 0; BSF PORTB, 7 BTFSC PORTD, 5 GOTO STOPS BTFSC PORTD, 6 GOTO STOPS BSF PORTD, 2 BCF PORTD, 3 REP16 BTFOT PORT, BTS PTS 6 PTS GOTO STOPLAR Qo'ng'iroq qilish SDELAY CALL STALL2 BTFSC MSTOP, 2 GOTO STOPS BANKSEL PIR1 BTFSC PIR1, RCIF GOTO RXDATA GOTO REP16 GOTO CLROE; ************************* ****************** HOPEN BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; BUTTLEVEL;, 0; BSF PORTB, 7 BTFSC PORTD, 4 GOTO STOPS BCF PORTD, 2 BSF PORTD, 3 REP17 BTFSC PORTD, 4 GOTO STOPS CALL STELAY CALL STALL2 BTFSC MSTOP, 2 GOTO STOPS BANKSEL PIR1 ROTO BATFS RESPTIR GOTO CLROE; *************************************** HUP BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; BUTTLEVELga qo'ng'iroq qilish; BTFSC MSTOP, 1; GOTO STOPLAR DARKLIGHT BTFSC LDET, 0; BSF PORTB, 7 BTFSC PORTC, 4 GOTO PORT, 4 GOTO PORT BTFSC PORTC, 4 GOTO STOP STANS BANKSEL PIR1 BTFSC PIR1, RCIF GOTO RXDATA GOTO REP18 GOTO CLROE; ***************************** ************ HDOWN BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; CUT BUTTLEVEL; BTFSC MSTOP, 1; GOTO STOPLAR DARKLIGHT BTFSC LDET, 0; BSF PORTB 7 BTFSC PORTC, 5 GOTO STOPS BSF PORTC, 0 BCF PORTC, 3 REP19 BTFSC PORTC, 5 GOTO STOPS BANKSEL PIR1 BTFSC PIR1, RCIF GOTO RXDATA GOTO REP19 GOTO CLROE; *************** **************************** LON BSF PORTB, 7 BSF LDET, 0 GOTO CLROE; ********** ********************************* LOFF BCF PORTB, 7 BCF LDET, 0 GOTO CLROE; ***** *********************************** LFOLLOW BCF STATUS, RP0 BCF STATUS, RP1 BCF PORTB, 1 BCF PORTB, 2 BCF PORTB, 6 BCF PORTB, 7 qo'ng'iroq PWM1OFF qo'ng'iroq PWM2OFF BCF PORTD, 0 BCF PORTD, 1 BCF PORTD, 2 BCF PORTD, 3 BSF MSTOP, 6 REPLF; BANKSEL OPTION_REG; BSF OPTION_REG, 3; BGF OPT_, 3; CLRFWDT BCF STATUS, RP0 BCF STATUS, RP1; BANKSEL INTCON; BCF INTCON, T0IE; BCF INTCON, T0IF; BANKSEL PIE1; BCF PIE1, 6; BCF PIE1, 0; BANKSEL INTCONCON, 0 BCF PCON, 1 NOP BSF PCON, 0 BSF PCON, 1 BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP Qo'ng'iroqlar SDELAY CALL LFC1 YO'Q Qo'ng'iroq LFC2 NOP MOVF LR2, 0 SUBWF LR1, 0 BTFSC STATUS, C GOTO LR2G LR1G BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP; BUTLANGAN DAVLO, BUTLANGA DAVLAT. 0X66 MOVWF SPEED12 MOVLW 0XFF MOVWF SPEED21 MOVLW 0X99 MOVWF SPEED22 CHAQIRISH PWM1ON CHAQIRISH PWM2ON BSF PORTD, 0 BCF PORTD, 1 BSF PORTB, 1 BCF PORTB, 2 LR1GREP; OPS BANKSEL PIR1 BTFSC PIR1, RCIF GOTO RXDATA CALL LFC1 NOP CALL LFC2 NOP MOVF LR2, 0 SUBWF LR1, 0 BTFSC STATUS, Z GOTO REPLF CALL LFC1 NOP CALL LFC2 NOP MOV GROFT LR2, MOVF LR2 REPLF LR2G BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0x00 MOVWF MSTOP; cALL BUTTLEVEL; BTFSC MSTOP, 1; GOTO Bekatlar MOVLW 0xff MOVWF SPEED11 MOVLW 0X99 MOVWF SPEED12 MOVLW 0xff MOVWF SPEED21 MOVLW 0X66 MOVWF SPEED22 cALL PWM1ON cALL PWM2ON BCF PORTD, 0 BSF PORTD, 1 BCF PORTB, 1 BSF PORTB, 2 LR2GREP; Qo'ng'iroq qilish STALL1; BTFSC MSTOP, 0; GOTO BANKSEL PIR1 BTFSC PIR1, RCIF GOTO RXDATA CALL LFC1 NOP CALL LFC2 NOP MOV MOVF LR2, MOVF LR2 Qayta qo'ng'iroq LFC1 YO'Q QO'NG'IR LFC2 NOP MOVF LR2, 0 SUBWF LR1, 0 BTFSC STATUS, C GOTO LR2GREP GOTO REPLF FRONT BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MVFT MOVFT MOVF; SPEED11 MOVLW 0X99 MOVWF SPEED12 MOVLW 0XFF MOVWF SPEED21 MOVLW 0X99 MOVWF SPEED22 Qo'ng'iroq PWM1ON Qo'ng'iroq PWM2ON BCF porti D, 0 BCF PORTD, 1 BSF PORTB, 1 BSF PORTB, 2 CALL SDELAY FROREP; CALL STALL1; BTFSC MSTOP, 0; GOTO STOPLAR BANKSEL PIR1 BTFSC PIR1, RCIF GOTO RXDATA; NOP CALL LFC2 NOP MOVF LR2, 0 SUBWF LR1, 0 BTFSC STATUS, Z GOTO FROREP GOTO REPLF GOTO CLROE; ************************* **************** BTFSS MSTOP, 4 GOTO STOPA MOVLW 0XCF MOVWF SPEED11 MOVLW 0XB3 MOVWF SPEED12 MOVLW 0XCF MOVWF SPEED21 MOVLW 0XB3 MOVWF SPEED2 CALL PWM PWM PWM1 1 qo'ng'iroq SDELAY STOPA BCF STATUS, RP0 BCF STATUS, RP1 BCF PORTB, 1 BCF PORTB, 2 BCF PORTB, 6 BTFSS LDET, 0; BCF PORTB, 7 BCF PORTC, 0 BCF PORTC, 3 CALL PWM1OFF CALL PWM2OFF PWM2OFF PORTD, 1 BCF PORTD, 2 BCF PORTD, 3 MOVLW 0X00 MOVWF MSTOP; ******************************** ********* CLROE BANKSEL RCSTA BCF RCSTA, CREN BCF RCSTA, FERR BCF RCSTA, OERR BSF RCSTA, CREN BSF INTCON,GIE BSF INTCON, PEIE GOTO WAIT1; ************************************** *; *****************************************; **** ************************************* STALL1 BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BANKSEL ADCON0 BCF ADCON0, 3 BCF ADCON0, 4 BCF ADCON0, 5 BCF ADATON, 5 BCF STATUS, RP0 BCF STATUS, RP1 CALL CONVERT MOVF ADRESH, 0 SUBLW 0X70 BTFSS STATUS, C BSF STST, C BSFF RSTF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BANKSEL ADCON0 BSF ADCON0, 3 BCF ADCON0, 4 BCF ADCON0, 5 BCF STATUS, RP0 BCF STATUS, RP1 CALL CONVERT MOVF ADFS, 4 -ADFON, 0 STATUS, RP0 BCF STATUS, RP1 RETURNBUTTLEVEL BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BANKSEL ADCON0 BCF ADCON0, 3 BCF ADCON0, 4 BSF ADCON0, 5 ADFF STF, 0 BCF STF BTFSS STATUS, C GOTO BL1 GOTO BL2 BL1 BSF MSTOP, 1 BSF PORTB, 6 BL2 RIGHURN DARKLIGHT BCF STATUS, RP0 BCF STATUS, RP1 BTFSC LDET, 0 GOTO RETFDL BANKSEL ADCON0 BCF ADCON0, 3 BSF ADCON0, 4 BCF ADCON0, 4 BCF ADCON0, 5 BCF STATUS, RP0 BCF STATUS, RP1 CALL CONVERT MOVF ADRESH, 0 SUBLW 0XEE BTFSS STATB BELGA, CV BSV, CV, CV, CV, CV BCF ADCON0, 7 BSF ADCON0, 6 BSF ADCON0, 0 BSF ADCON0, GO WAITADC BTFSC ADCON0, GO WAITADC BTFSC ADCON0, GO GOTO WAITADC BCF STATUS, RP1 BCF STATUS, RP0 RETURNPWM1ON BANKSEL PRF MFF ROV MOVF0 MOVWF CCP1CON MOVF SPEED12, 0 MOVWF CCPR1L BSF STATUS, RP0 BCF STATUS, RP1 MOVLW 0XF0 MOVWF TRISC BCF STATUS, RP0 BCF STATUS, RP1 BCF T2CON, T2CKPS1 BCF T2CON, T2CKPS0 BSF T2CON, TMR2ON BSF CCP1CON, 2 BSF CCP1CON, 3 RETURNPWM2ON BANKSEL PR2 MOVLW 0XFF MOVWF PR2 BCF STATUS, RP0 BCF STATUS, RP1 MOVF SPEED21, 0 MOVWF CCP2CON MOVF SPEED22, 0 MOVWF CCPR2L BSF STATUS, RP0 BCF STATUS, RP1 MOVL T2CON, T2CKPS0 BSF T2CON, TMR2ON BSF CCP2CON, 2 BSF CCP2CON, 3 Qaytish M1OFF BCF CCP1CON, 2 BCF CCP1CON, 3 BSF T2CON, T2CKPS1 BSF T2CON, T2CKPS0 BCF T2CON, TMR2ON MOVLW 0x00 MOVWF CCP1CON MOVLW 0x00 MOVWF CCPR1L BANKSEL PR2 MOVLW 0x00 MOVWF PR2 BCF STATUS, RP1 BCF STATUS, RP0 RETURNPWM2OFF BCF CCP2CON, 2 BCF CCP2CON 3 BSF T2CON, T2CKPS1 BSF T2CON, T2CKPS0 BCF T2CON, TMR2ON MOVLW 0x00 MOVWF CCP2CON MOVLW 0x00 MOVWF CCPR2L BANKSEL PR2 MOVLW 0x00 MOVWF PR2 BCF STATUS, RP1 BCF STATUS, RP0 RETURNLFC1 BANKSEL ADCON0 BSF ADCON0, 3 BCF ADCON0, 4 BSF ADCON0, 5 BCF STATUS, RP0 BCF STATUS, RP1 CALL CONVERT MOVF ADRESH, W ANDLW 0XF0 MOVWF LR1 BCF STATUS, RP0 BCF STATUS, RP1 RETURN LFC2 BANKSEL ADCON0 BCF ADCON0, 3 BSF ADS0 ADCON0 RP1 CALL CONVERT MOVF ADRESH, 0 ANDLW 0XF0 MOVWF LR2 BCF STATUS, RP0 BCF STATUS, RP0 BCF STATUS, RP1 RETURN LDIN BANKSEL ADCON0 BCF ADCON0, 3 BSF ADCON0, 4 BCF ADCON0, 5 ADPCFTFTFTV 0X4C BTFSC STATUS, C GOTO COMP4 BSF MSTOP, 3 COMP4 BCF STATUS, RP0 BCF STATUS, RP1 SDELAY CLRF L2 XL3 CLRF L1 XL2 CLRF TMR0 XL1 MOVLW 0XFF SUBWF TMR0, W BTFSS STATUS, C GOTO XL1 MOVLW 0X20 INCF L1 SUBWF L1, W BTFSS STATUS CUT2, CUT GOT2, CV GOTO, 2 GOV XL3 QAYTISH NOP NOPEND
Instructables va RoboGames robot tanlovida ikkinchi sovrin
Tavsiya:
To'g'ridan-to'g'ri raqamli sintez (DDS) chipli MIDI tomonidan boshqariladigan qadam dvigateli: 3 qadam
To'g'ridan-to'g'ri raqamli sintez (DDS) chipli MIDI tomonidan boshqariladigan qadamli dvigatel: Siz hech qachon mini-loyihaga aylanishingiz kerak degan yomon fikrga keldingizmi? Xo'sh, men AD9833 to'g'ridan -to'g'ri raqamli sintez (DDS) moduli yordamida musiqa yaratishga qaratilgan Arduino Due uchun chizgan eskiz bilan o'ynab yurardim … va bir paytlar men o'yladim
Arduino uchun qadam tezligini boshqarish menyusi: 6 qadam
Arduino uchun qadam tezligini boshqarish menyusi: Bu SpeedStepper kutubxonasi qadam dvigatelining tezligini nazorat qilish uchun AccelStepper kutubxonasining qayta yozilishi. SpeedStepper kutubxonasi sizga belgilangan dvigatel tezligini o'zgartirishga imkon beradi, so'ngra xuddi shu algoritm yordamida yangi belgilangan tezlikka tezlashadi/sekinlashadi
Qanday qilib qadam taymerini yasash mumkin?: 3 qadam (rasmlar bilan)
Qanday qilib qadam taymerini yasash mumkin ?: Men ko'plab sport turlarida yaxshi qatnashardim: yurish, yugurish, velosiped haydash, badminton o'ynash va hokazo. Men tez orada sayohat qilishni yaxshi ko'raman. Xo'sh, qorin qornimga qarang …… Xo'sh, baribir, men mashg'ulotlarni qaytadan boshlashga qaror qildim. Qanday uskunani tayyorlashim kerak?
Arduino UNO bilan qadam motor: 3 qadam
Arduino UNO bilan qadam dvigateli: Bosqichli motorlar - bu alohida bosqichlarda harakatlanadigan shahar motorlari. Ularda "fazalar" deb nomlangan guruhlarga bo'lingan bir nechta rulon bor. Har bir fazani ketma -ket quvvatlantirganda, dvigatel birma -bir aylanadi, zinapoyali dvigatellar juda foydali
Kompyuteringizni qadam dvigateli bilan boshqaring!: 9 qadam (rasmlar bilan)
Kompyuteringizni qadam dvigateli bilan boshqaring!: Oldingi ko'rsatmalarimdan birida men sizga step motorini aylanuvchi kodlovchi sifatida qanday ishlatishni ko'rsatdim. Bu yo'riqnomada keling, undan kompyuterni boshqarish uchun qanday foydalanish kerakligini bilib olaylik. Shunday qilib, ko'p vaqt sarflamasdan, boshlaylik