Sadržaj:

Stijena: 8 koraka
Stijena: 8 koraka

Video: Stijena: 8 koraka

Video: Stijena: 8 koraka
Video: Как разобраться в корнях ? Квадратный корень 8 класс | Математика TutorOnline 2024, Studeni
Anonim
Stijena
Stijena

Robotom upravlja vizualni osnovni program (kroz serijski port), a može se kretati u tri različite brzine pomoću signala s moduliranom širinom impulsa (PWM) generiranog od PIC mikrokontrolera (16F877). Robotom se može upravljati u dva načina rada, načinima "normalnog upravljanja" i "svjetlosnog praćenja". U normalnom načinu upravljanja, robot može nositi predmete veličine od 3 - 18 cm od mjesta do drugog unutar 150 m. budući da u načinu praćenja svjetla prati svjetlo u mračnoj prostoriji. Korišteno je mnogo senzora, poput svjetlosnih senzora; osjetnik nagiba, osjetljivost struje zastoja, mjerenje razine baterije te neki krajnji prekidači i osjetnici dodira koji se koriste u ruci. Brzinu može održavati konstantnom kad ide na brdo (nagnuto) i automatski pali svjetlo kada postane mračno mračno. Također radi zaštite IC -a, on isključuje struju kad se zaglavi, a ruka prestane držati nešto.4 Upotrijebljeni su istosmjerni motori kontrolirani PIC mikrokontrolerom 16F877 i 3 sklopa upravljačkih programa motora. Trajalo je oko 4 mjeseca i košta oko 600 USD

Korak 1: Osmislite projekt

Dizajnirajte Projekt
Dizajnirajte Projekt
Dizajnirajte Projekt
Dizajnirajte Projekt

u početnoj je fazi dat dizajn projekta. uglavnom, definiranje blok dijagrama; vidi sliku.

U ovoj fazi potreban je detaljniji dijagram kruga, međutim kako bi se to olakšalo, identificirani su glavni moduli: 1. Mikrokontroler 2. Senzori 3. Motori 4. Bežično kolo 5. Program za računalo. Urađen je i 3D dizajn, pogledajte sliku.

Korak 2: Odaberite uređaje i komponente

U ovoj fazi dizajner bi trebao odabrati uređaje i komponente potrebne za izradu robota.

To uključuje: bežični krug (MAX232, LM331, FM odašiljač i prijemnički moduli), motore (4 istosmjerna motora), krug upravljačkih programa motora (H-most), mikrokontroler PIC (16F877), bateriju, regulatore napona (MC7805), mikroprekidače, Fotootpornici, osjetnik nagiba … itd. Važno je razumjeti mogućnost izračunavanja ovih uređaja i njihov zajednički rad.

Korak 3: Mikrokontroler

Mikrokontroler
Mikrokontroler

Ovaj korak je najvažniji korak. na početku treba identificirati kodove koji će biti primljeni i poslani od PIC -a.

Počnite spajati komponente na odgovarajuće pinove PIC -a i programirajte mikrokontroler. To može zahtijevati izgradnju malih krugova pomoću regulatora, otpornika, senzora … itd.

Korak 4: Napišite PC program

Napišite PC program
Napišite PC program
Napišite PC program
Napišite PC program

Program je napisan na basic basic.

Komunikacija je uspostavljena putem RS-232. Korištenje MSComm za slanje podataka mikrokontroleru konfiguriranjem postavki (broj porta, brzina prijenosa, paritetni broj bitova podataka, zaustavni bitovi). Koristio sam 8-bitne podatke s jednim bitom i paritetom pri brzini prijenosa 9600 bps.

Korak 5: Izgradite tijelo

Izgradite tijelo
Izgradite tijelo
Izgradite tijelo
Izgradite tijelo

Dobar dizajn tijela je važan. Također odabirom rasporeda kotača, pogledajte sliku.

Robot je izgrađen nakon što se uvjerio da programi rade dobro. Ovaj korak možete učiniti i prije programiranja.

Korak 6: Izgradite bežični krug

Izgradite bežični krug
Izgradite bežični krug

Izgradnja bežičnog kruga može biti neovisna. U početnoj fazi koristio sam žicu za povezivanje računala s robotom, a nakon finalizacije robota integrirano je bežično kolo.

Korak 7: Integrirajte

Integrirati
Integrirati

Ovo je trenutak kada smo integrirali naše komponente i testirali robota.

Korak 8: Programski kod mikrokontrolera

; *************** ZAVRŠNI ******************************** popis p = 16f877 uključuju radiks decidloke "V" << 8 | "1"; Verzija No.config _CP_OFF & _PWRTE_OFF & _WDT_OFF & _XT_OSC; ********** glavna varijabla *************************** cblock 0x20; početak banka 0 ram područje INPUT_VAR L1 L2 X SPEED11 SPEED12 SPEED21 SPEED22 MSTOP LDET LR1 LR2 endc; ********** početak glavnog programa *************** start BSF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X40 MOVWF ADCON1 MOVLW 0XFF; PORT A IS I MOVWF TRISA MOVLW 0XF0; TRISD MOVLW 0X07; PORT E IS I MOVWF TRISE BANKSEL OPTION_REG BCF OPTION_REG, T0CS BCF STATUS, RP1 BCF STATUS, RP0; ************************* ******************; ******************************* ******** 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 BANKSEL RCSTA BSF RCSTA, SPC RCSTA, SPC RCSTA, SPC, OERR GOTO CLROE BANKSEL PIE1 BSF PIE1, RCIE BANKSEL RCSTA BCF RCSTA, RX9 BSF RCSTA, CRENWAIT1 BANKSEL PORTB BSF PORTB, 3 BSF PORTB, 4 BANKSEL PIR1 BTFSS PIR1, PFF, PCF, PCF POZIV PWM1OFF CALL PWM2OFF CALL DARKLIGHT BTFSC LDET, 0 BSF PORTB, 7RXDATA; BTFSC RCSTA, OERR; 0; *******************************************; **** ************************************* MOVWF INPUT_VAR MOVLW 0X00 MOVWF RCREG BCF STATUS, RP0 BCF STATUS, RP1 MOVF INPUT_VAR, 0; STOP SUBLW 0X53 BTFSC STATUS, Z GOTO ZAUSTAVLJA MOVF INPUT_VAR, 0; SVJETLO NA SUBLW 0X4E BTFSC STATUS, Z GOTO LON MOVF INPUT_VAR, 0 FVFO FUTO, SJAVLJAČ, SJAVLJENO SVJETLO, SVJETLO, SJAVLJAČ 0; POKRETI NAPRIJED SLABO SUBLW 0X66 BTFSC STATUS, Z OGROMENO SPUŠTANJE MOVF INPUT_VAR, 0; POKRETI DESNO SPORO SUBLW 0X72 BTFSC STATUS, Z OGLASITE USPORITI MOVF INPUT_VAR, 0; POKRETI LIJEVO POROČNO X6C BTFSC STATUS, Z OGROMENO NISKO MOVF INPUT_VAR, 0; POKRETI SE NAZAD POROČNO SUBLW 0X62 BTFSC STATUS, Z GOTO POSMERI MOVF INPUT_VAR, 0; POMIKNI NAPRIJED SREDNJI SUBLW 0X46 MTFVETO MFV, FUTO VSM, FUTO, MFF STATUS, Z GOTO RMED MOVF INPUT_VAR, 0; POKRETI LIJEVI SREDNJI SUBLW 0X4C BTFSC STATUS, Z GOTO LMED MOVF INPUT_VAR, 0; POKRETI SE NAZAD MEDIJSKI SUBLW 0X42 BTFSC STATUS, Z GF Z GOTO FFAST MOVF INPUT_VAR, 0; POKRETI SE DESNO BRZO SUBLW 0X57 BTFSC STATUS, Z GOTO RFAST MOVF INPUT_VAR, 0; POKRETI LIJEVO BRZO SUBLW 0X56 BTFSC STATUS, Z GOTO LFAST MOVFO, MOVF VSTV BFAST MOVF INPUT_VAR, 0; HAND CLOSE SUBLW 0X43 BTFSC STATUS, Z GOTO HCLOSE MOVF INPUT_VAR, 0; HANDO OPEN SUBLW 0X4F BTFSC STATUS, Z GOTO HOPEN MOVF INPUT_VAR, HVF, HVF, HVF; RUČNO DOLJE SUBLW 0X64 BTFSC STATUS, Z GOTO HDOWN MOVF INPUT_VAR, 0; SVJETLO Slijedi 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; CALL BUTTLEVEL; BTFTSCT MSTOP LDET, 0; BSF PORTB, 7 NORMALSLOW MOVLW 0XFF MOVWF SPEED11 MOVLW 0X66 MOVWF SPEED12 MOVLW 0XFF MOVWF SPEED21 MOVLW 0X66 MOVWF SPEED22 POZIV PWM1ON POZIV PWM PBFFON, BCF, RCIF GOTO RXDATA GOTO REP3 GOTO CLROE; *************************************** ** LSLOW BCF STATUS, RP0 BCF STATUS, RP1; TIPKA POZIVA; BTFSC MSTOP, 1; IDITE NA ZAUSTAVLJANJE MOVLW 0X00 MOVWF MSTOP BCF LDET, 0 POZIV TAMNO SVJETLO BTFSC LDET, 0; BSF PORTB, 7 MOVLWW MKVW MWFW MKWW MKWW MXV MWW 0XCF MOVWF SPEED21 MOVLW 0X66 MOVWF SPEED22 CALL PWM1ON CALL 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 STOPS MOVLW 0X00 MOVWF MSTOP BCF LDET, 0 CALL DARKLIGHT BTFSC LDET, 0; BSF PORTB, 7 MOVLW 0XCF MOVWF SPEED11 MOVLW 0X66 MOVWF SPEED12 MOVLW 0XFF MOVWF SPEED21 MOVLW 0X99 MOVWF SPEED22 POZIV PWM1ON POZIV PWM2ON BCF PORTD, 1 BCF PORT BFR P1 BTS **************************** BSLOW BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; TIPKA POZIVA; BTFSC MSTOP, 1; IDITE NA ZVANJE DARKLIGHT BTFSC LDET, 0; BSF PORTB, 7 MOVLW 0XCF MOVWF SPEED11 MOVLW 0X99 MOVWF SPEED12 MOVLW 0XCF MOVWF SPEED21 MOVLW 0X99 MOVWFF POWER PFD PORTB, 2 REP5 BANKSELA 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; DUGMOJ POZIV; BTFSC MSTOP, 1; GOTO ZAUSTAVLJANJE POZIV TAMNO SVJETLO BTFSC LDET, 0; BSF PORTB, 7 NORMALFMVFWMWFWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMMWMWMWMMWMWMMWMWMWMMWMWMMWMMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMMWMWMWMMWMWMMWMWMMWMMWMMWMMM, NJEVE MOVI MOVWF SPEED21 MOVLW 0X99 MOVWF SPEED22 POZIV PWM1ON POZIV PWM2ON BCF PORTD, 0 BCF PORTD, 1 BSF PORTB, 2 BESPLATNI POZIV STOP1 BTFSC BSTF POPT BOPKS, BOTS BOPKS GOTO REP6 PLUSEMED MOVLW 0XCF MOVWF SPEED11 MOVLW 0XCC MOVWF SPEED12 MOVLW 0XCF MOVWF SPEED21 MOVLW 0XCC MOVWF SPEED22 POZIV PWM1ON POZIV PWM2ON BCF PORTFORT, 0 BCF PORTFORT, 0 BCF PORT 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; CALL BUTTLEVEL; BTFSC MSTOP, 1; GOTO STOPS CALL DARKLIGHT BTFSC LDET, 0; BSF PORT B, 7 MOVLW 0XFF MOVWF SPEED11 MOVLW 0XFF MOVWF SPEED21 MOVLW 0X66 MOVWF SPEED22 CALL PWM1ON CALL PWM2ON BCF PORTD, 0 BSF PORTD, 1 BCF POP BTFSC PIR1, RCIF GOTO RXDATA GOTO REP8 GOTO CLROE; ************************************* **** LMED BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; POZIVNI DUGMOR; BTFSC MSTOP, 1; GOTO STOPS CALL DARKLIGHT BTFSC LDET, 0; BSF PORTB, 7 MOVLWW MWFWW MXWWWWWWWXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX --SLV 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 REP9; REP9 GOTO CLROE; ***************************************** BMED BCF STATUS, RP0 STATUS BCF -a, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; POZIVNI TASTER; BTFSC MSTOP, 1; GOTO ZAUSTAVLJA POZIV DARKLIGHT BTFSC LDET, 0; BSF PORTB, 7 MOVLW 0XFF MOVWF SPEED11 MOVLW 0X7F MOVWF SPEED12 MOVLW 0XFF MOVWF SPEED21 MOVLW 0X7F MOVWF SPEED22 CALL PWM1ON CALL PWM2ON BSF PORTD, 0 BSF PORTD, 1 BCF PORTB, 2 REPT ST. REP10 GOTO CLROE; *************************************** FFAST BCF STATUS, RP0 STANJE BCF -a, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0 BSF MSTOP, 4; DUGMOJ ZVUK MOVWF SPEED21 MOVLW 0X7F MOVWF SPEED22 CALL PWM1ON CALL PWM2ON BCF PORTD, 0 BCF PORTD, 1 BSF PORTB, 1 BSF PORTB, 2 POZIVA SDELAY NORMALFAST MOVLW 0XCF MOVWF SPEED11 MOVLW 0XCC MOVWF SPEED12 MOVLW 0XCF MOVWF SPEED21 MOVLW 0XCC MOVWF SPEED22 CALL PWM1ON CALL PWM2ON BCF PORTD, 0 BCF PORTD, 1 BTFSC LDET, 0 BSF PORTB, 7 BSF PORTB, 1 BSF PORTB, 2 REP11 POZIV STALL1 BTFSC MSTOP, 0 GOTO STOPS BANKSEL PIR1 BTFSC PIR1, RCIF GOTO RXDATA NOP BTFDS PTFS PTS AST MOVLW 0XCF MOVWF SPEED11 MOVLW 0XCF MOVWF SPEED21 MOVLW 0XFF MOVWF BRZINA22 POZIV PWM1ON PWM2ON BCF PORTD, 1 BSF POP 1, BSF, 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 STOPS CALL DARKLIGHT BTFSC LDET, 0; BSF PORTB, 7 MOVLWX SPEED11 MOVLW 0X99 MOVWF SPEED12 MOVLW 0XFF MOVWF SPEED21 MOVLW 0X66 MOVWF SPEED22 CALL PWM1ON CALL PWM2ON BCF PORTD, 0 BSF PORTB, 2 REPR. GOTO REP13 GOTO CLROE; *************************************** LFAST BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; TIPKA POZIVA; BTFSC MSTOP, 1; GOTO STOPS CALL 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 POZIVA SDELAY MOVLW 0xff MOVWF SPEED11 MOVLW 0X4C MOVWF SPEED12 MOVLW 0XEF MOVWF SPEED21 MOVLW 0XB3 MOVWF SPEED22 POZIV PWM1ON POZIV PWM2ON BSF PORTD, 0 BCF PORTD, 1 BSF PORTB, 1 BCF PORTB, 2 REP14 POZIV STALL1 BTFSC MSTOP, 0 GOTO STOPS GOTO BOTO **************************************** BFAST BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; POZIVNI BUTTLE; BTFSC MSTOP, 1; GOTO STOPI POZIV TAMNI SVJETLO, 0; BSF PORTB, 7 MOVLW 0XDF MOVWF SPEED11 MOVLW 0XW MOV PWM2ON BSF PORTD, 0 BSF PORTD, 1 BCF PORTB, 1 BCF PORTB, 2 POZIVA SDELAY MOVLW 0XEF MOVWF SPEED11 MOVLW 0X66 MOVWF SPEED12 MOVLW 0XEF MOVWF SPEED21 MOVLW 0X66 MOVWFWW SPE22 PORTD, 0 BSF PORTD, 1 BCF PORTB, 1 BCF PORTB, 2 REP15 POZIV STALL1 BTFSC MSTOP, 0 GOTO STOPS BANKSEL PIR1 BTFSC PIR1, RCIF GOTO RXDATA GOTO REP15 GOTO CLROE; ************* ****************************** HCLOSE BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; POZIVNI BUTTLEVEL; 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 BTFSC PORTD, 5 GOTO GOTO STOPS POZIV 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; CALL BUTTLEVEL; BTFSC MSTOP, 1; GOTO STOPS CALL DARKLIGHT BTFSC LDET, 0; BSF PORTB, 7 BTFSC PORTD, 4 GOTO STOPS BCF PORTD, 2 BSF PORTD, 3 REP17 BTFSC PORTD, 4 GOTO STOPS CALL SDELAY CALL STALL2 BTFSC MSTOP, 2 GOTO STOPS BANKSEL PIR1 BTFSC POT1 GOTO CLROE; ***************************************** HUP BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; POZIVNI TIPAK; BTFSC MSTOP, 1; GOTO STOPS CALL DARKLIGHT BTFSC LDET, 0; BSF PORTB, 7 BTFSC PORTC, 4 GOTO STOPS BCF 18 BTFSC PORTC, 4 GOTO STOPS 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; CALL BUTTLEVEL; BTFSC MSTOP, 1; GOTO STOPS CALL 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 POZIVA PWM1OFF POZIV PWM2OFF BCF PORTD, 0 BCF PORTD, 1 BCF PORTD, 2 BCF PORTD, 3 BSF MSTOP, 6 REPLF; OPCIJA OPCIJE_BARKE, 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 INTCON; BCF INTCON, GIE BANK, 0 BCF PCON, 1 NOP BSF PCON, 0 BSF PCON, 1 BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP POZIV SDELAY CALL LFC1 NOP CALL LFC2 NOP MOVF LR2, 0 SUBWF LR1, 0 BTFSC STATUS SDELAY CALL LFC1 NOP CALL LFC2 NOP MOVF LR2, 0 SUBWF LR1, 0 BTFSC STATUS, C GOTO LR2G LR1G BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP; CALL BUTTLEVLOV; 0X66 MOVWF SPEED12 MOVLW 0XFF MOVWF SPEED21 MOVLW 0X99 MOVWF SPEED22 POZIV PWM1ON POZIV PWM2ON BSF PORTD, 0 BCF PORTD, 1 BSF PORTB, 1 BCF PORTB, 2 LR1GREP; CALL STALL1; OPS BANKSEL PIR1 BTFSC PIR1, RCIF IDI NA RXDATA POZIV LFC1 NOP POZIV LFC2 NOP MOVF LR2, 0 SUBWF LR1, 0 BTFSC STATUS, Z GOTO REPLF CALL LFC1 NOP CALL LFC2 NOP MOVF LRTO LRT, 0 SUB REPLF LR2G BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP; POZIVNI BUTTLE; BTFSC MSTOP, 1; PORTD, 1 BCF PORTB, 1 BSF PORTB, 2 LR2GREP; POZIV STALL1; BTFSC MSTOP, 0; GOTO STOPS BANKSEL PIR1 BTFSC PIR1, RCIF GOTO RXDATA CALL LFC1 NOP CALL LFC2 NOP MOVF LRTO, SUB, 0 SUB REPLF CALL LFC1 NOP CALL 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 MSTOP; SPEED11 MOVLW 0X99 MOVWF SPEED12 MOVLW 0XFF MOVWF SPEED21 MOVLW 0X99 MOVWF SPEED22 CALL PWM1ON CALL PWM2ON BCF PORT D, 0 BCF PORTD, 1 BSF PORTB, 1 BSF PORTB, 2 CALL SDELAY FROREP; CALL STALL1; BTFSC MSTOP, 0; GOTO STOPS BANKSEL PIR1 BTFSC PIR1, RCIF GOTO RXDATA; CALL LDIN; BTFSC MSTOPO, 3; GALL NOP CALL LFC2 NOP MOVF LR2, 0 SUBWF LR1, 0 BTFSC STATUS, Z GOTO FROREP GOTO REPLF GOTO CLROE; *************************** ********** 1 POZIV 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 POZIV PWM1OFF POZIV PWM2OFF BCF 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 STATUS, RP0 BCF STATUS, RP1 POZIVNI KONVERT MOVF ADRESH, 0 SUBLW 0X70 BTFSS STATUS, C BSF MSTOP2, BCF STOP, BCF 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 POZIV KONVERT MOVF ADRESH, 0 SUBTFS 0BSTSFS 2 BTS STATUS, RP0 BCF STATUS, RP1 STATUS RETURNBUTTLEVEL BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BANKSEL ADCON0 BCF ADCON0, 3 BCF ADCON0, 4 BSF ADCON0, 5 BCF STATUS SUPRT, FR0 BCF, RP0 BCF BTFSS STATUS, C GOTO BL1 GOTO BL2 BL1 BSF MSTOP, 1 BSF PORTB, 6 BL2 POVRATAK TAMNOG SVJETA BCF STATUS, RP0 BCF STATUS, RP1 BTFSC LDET, 0 IDITE NA RETFDL BANKSEL ADCON0 BCF ADCON0, 3 BSF ADCON0, 4 BCF ADCON0, 5 BCF STATUS, RP1 POZIV KONVERT MOVF ADRESH, 0 SUBLW 0XEE BTFSS STATUS, C BSF PONVER. BCF ADCON0, 7 BSF ADCON0, 6 BSF ADCON0, 0 BSF ADCON0, GO WAITADC BTFSC ADCON0, GO GOTO WAITADC BCF STATUS, RP1 BCF STATUS, RP0 RETURNPWM1ON BANKSEL PR2 MOVLW 0XFFF MOVW RPV 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, BSF2 TCP PR2 MOVLW 0XFF MOVWF PR2 BCF STATUS, RP0 BCF STATUS, RP1 MOVF BRZINA21, 0 MOVWF CCP2CON MOVF BRZINA22, 0 MOVWF CCPR2L BSF STATUS, RP0 BCF STATUS, RP1 MOVLW 0XF0 RPC BCTFF BCT, RPC BCT1 T2CON, T2CKPS0 BSF T2CON, TMR2ON BSF CCP2CON, 2 BSF CCP2CON, 3 RETURNPW 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 BCFCTFON BCF0, BCF0CFFON, RP2 5 BCF STATUS, RP0 BCF STATUS, RP1 CALL CONVERT MOVF ADRESH, W ANDLW 0XF0 MOVWF LR1 BCF STATUS, RP0 BCF STATUS, RP1 POVRAT LFC2 BANKSEL ADCON0 BCF ADCON0, 3 BSF ADCON0, 4 BSF BCF, BCF RP1 POZIVNI KONVERT MOVF ADRESH, 0 ANDLW 0XF0 MOVWF LR2 BCF STATUS, RP0 BCF STATUS, RP1 POVRATNI LDIN BANKSEL ADCON0 BCF ADCON0, 3 BSF ADCON0, 4 BCF ADCON0, 5 BCF STATUS, RP0 BCV STB 0X4C BTFSC STATUS, C IDITE COMP4 BSF MSTOP, 3 COMP4 BCF STATUS, RP0 BCF STATUS, RP1 POVRATAK 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, C GOTO WT2 WT2 XL3 POVRATAK NEMOJ NAPRAVITI

Druga nagrada na natjecanju robota Instructables i RoboGames

Preporučeni: