Kazalo:

The Rock: 8 korakov
The Rock: 8 korakov

Video: The Rock: 8 korakov

Video: The Rock: 8 korakov
Video: LPS - Osem korakov (Official music video) 2024, November
Anonim
The Rock
The Rock

Ta robot je krmiljen z vizualnim osnovnim programom (skozi serijska vrata) in se lahko premika v treh različnih hitrostih s signalom, moduliranim s širino impulza (PWM), ki ga ustvari mikrokontroler PIC (16F877). Robota lahko upravljate v dveh načinih, v načinu "normalni nadzor" in "sledenje svetlobi". V običajnem načinu upravljanja lahko robot nosi predmete velikosti 3 - 18 cm od drugega do drugega v razdalji 150 m. ker v načinu sledenja svetlobi sledi svetlobi v temni sobi. Uporabljenih je bilo veliko senzorjev, na primer svetlobnih senzorjev; senzor nagiba, zaznavanje stojnega toka, zaznavanje nivoja baterije ter nekatera končna stikala in senzorji na dotik, ki se uporabljajo v roki. Hitrost lahko ohranja konstantno, ko gre na hrib (nagnjena) in samodejno prižge luč, ko postane temno temno. Da bi zaščitili IC, odklopi tok, ko se zatakne, roka pa se ustavi, ko nekaj drži. 4 DC motorje so uporabljali pod nadzorom mikrokontrolerja PIC 16F877 in 3 vezja gonilnika motorja. To je trajalo približno 4 mesece in stane približno 600 $

1. korak: Oblikujte projekt

Oblikujte projekt
Oblikujte projekt
Oblikujte projekt
Oblikujte projekt

v začetni fazi je bila podana zasnova projekta. predvsem opredelitev blokovnega diagrama; glej sliko.

Na tej stopnji je potreben podrobnejši diagram vezja, vendar so za to olajšali glavne identificirane module: 1. Mikrokrmilnik 2. Senzorji 3. Motorji 4. Brezžično vezje 5. Program za osebni računalnik. Narejen je bil tudi 3D dizajn, glej sliko.

2. korak: Izberite naprave in komponente

Na tej stopnji mora oblikovalec izbrati naprave in komponente, potrebne za izdelavo robota.

To vključuje: brezžično vezje (moduli MAX232, LM331, FM oddajnik in sprejemnik), motorje (4 enosmerni motorji), vezje gonilnikov motorjev (H-most), mikrokrmilnik PIC (16F877), baterijo, regulatorje napetosti (MC7805), mikro stikala, Fotografski upori, senzor nagiba … itd. Pomembno je razumeti, kako so te naprave združljive in kako delujejo skupaj.

3. korak: Mikrokrmilnik

Mikrokrmilnik
Mikrokrmilnik

Ta korak je najpomembnejši korak. na začetku je treba identificirati kode, ki bodo prejete in poslane s PIC.

Začnite povezovati komponente z ustreznimi zatiči PIC in programirajte mikrokrmilnik. To lahko zahteva izgradnjo majhnih vezij z regulatorji, upori, senzorji itd.

4. korak: Napišite program za računalnik

Napišite program za osebni računalnik
Napišite program za osebni računalnik
Napišite program za osebni računalnik
Napišite program za osebni računalnik

Program je bil napisan na osnovi basic.

Komunikacija je bila vzpostavljena prek RS-232. Uporaba MSComm za pošiljanje podatkov v mikrokrmilnik z nastavitvijo nastavitev (številka vrat, hitrost prenosa podatkov, paritetno število podatkovnih bitov, zaustavitveni bitovi). Uporabil sem 8-bitne podatke z enim bitom in parnostjo pri hitrosti prenosa 9600 b / s.

5. korak: Zgradite telo

Zgradite telo
Zgradite telo
Zgradite telo
Zgradite telo

Pomembna je dobra zasnova telesa. Tudi pri izbiri razporeda koles glejte sliko.

Robot je bil zgrajen, ko je zagotovil, da programi dobro delujejo. Ta korak je mogoče izvesti tudi pred programiranjem.

6. korak: Zgradite brezžično vezje

Zgradite brezžično vezje
Zgradite brezžično vezje

Gradnja brezžičnega vezja je lahko neodvisna. V začetni fazi sem uporabil žico za povezavo računalnika z robotom, po dokončanju robota pa je bilo integrirano brezžično vezje.

7. korak: Integracija

Integrirajte
Integrirajte

To je trenutek, ko smo integrirali naše komponente in preizkusili robota.

8. korak: programska koda mikrokrmilnika

; *************** KONČNI seznam ****************************** p = 16f877 vključuje radiks decidloke "V" << 8 | "1"; Različica No.config _CP_OFF & _PWRTE_OFF & _WDT_OFF & _XT_OSC; ********** glavna spremenljivka *************************** cblock 0x20; začetek bank 0 ram area INPUT_VAR L1 L2 X SPEED11 SPEED12 SPEED21 SPEED22 MSTOP LDET LR1 LR2 endc; ********** zagon glavnega 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; ************************* ******************; ******************************* ************ POČAKAJTE 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 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, 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, PCF, PCF, WC CALL 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 VP. 0; PREMIKAJ NAPREJ POČASNO SUBLW 0X66 BTFSC STATUS, Z GOTO POMEMBLJANJE MOVF INPUT_VAR, 0; PREMIKAJ DESNO POČASNO SUBLW 0X72 BTFSC STATUS, Z GOTO ZASPLAČITE MOVF INPUT_VAR, 0; X6C BTFSC STATUS, Z GOTO NIZKI POMIK MOVF INPUT_VAR, 0; PREMIKAJ NAZAJ NAZAJ POČASNO SUBLW 0X62 BTFSC STATUS, Z GOTO NAPREJ MOVF VP. STATUS, Z GOTO RMED MOVF INPUT_VAR, 0; PREMIKNI LEVI SREDNJI SUBLW 0X4C BTFSC STATUS, Z GOTO LMED MOVF INPUT_VAR, 0; POMIKAJ NAZAJ MEDIJSKI SUBLW 0X42 BTFSC STATUS, Z GF Z GOTO FFAST MOVF INPUT_VAR, 0; PREMAKNI DESNO HITRO SUBLW 0X57 BTFSC STATUS, Z GOTO RFAST MOVF INPUT_VAR, 0; BFAST MOVF INPUT_VAR, 0; ROČNO ZAPRTO SUBLW 0X43 BTFSC STATUS, Z GOTO HCLOSE MOVF INPUT_VAR, 0; HANDO OPEN SUBLW 0X4F BTFSC STATUS, Z GOTO HOPEN MOVF INPUT_VAR, 0 HWF, HVF, HVF; STOP STOPA SUBLW 0X64 BTFSC, 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; KLICNI BUTTLEVEL; BTFTSC MSTOP LDET, 0; BSF PORTB, 7 NORMALSLOW MOVLW 0XFF MOVWF SPEED11 MOVLW 0X66 MOVWF SPEED12 MOVLW 0XFF MOVWF SPEED21 MOVLW 0X66 MOVWF SPEED22 KLIC PWM1ON KLIC PWM PBFBORT, BCF, RCIF GOTO RXDATA GOTO REP3 GOTO CLROE; *************************************** ** LSLOW BCF STATUS, RP0 BCF STATUS, RP1; KLICNI BUTTLEVEL; BTFSC MSTOP, 1; GOTO STOPS MOVLW 0X00 MOVWF MSTOP BCF LDET, 0 CALL DARKLIGHT BTFSC LDET, 0; BSF PORTB, 7 MOVLWW MOV, WWW, MOV, MOV 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 KLIC PWM1ON KLIC PWM2ON BCF PORTD, 1 BCF PORT BTS **************************** BSLOW BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; KLICNI BUTTLEVEL; BTFSC MSTOP, 1; GOTO ZAUSTAVI KLIK DARKLIGHT BTFSC LDET, 0; BSF PORTB, 7 MOVLW 0XCF MOVWF SPEED11 MOVLW 0X99 MOVWF SPEED12 MOVLW 0XCF MOVWF SPEED21 MOVLW 0X99 MOVWFF PONV. 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; KLICNI BUTTLEVEL; BTFSC MSTOP, 1; GOTO ZAUSTAVI KLIK DARKLIGHT BTFSC LDET, 0; BSF PORTB, 7 NORMALFWMWMWMWMWMWMWMWMWMWMWMWMWMWMWMWM, MOV, MOV, MF, MOV MOVWF SPEED21 MOVLW 0X99 MOVWF SPEED22 CALL PWM1ON CALL PWM2ON BCF PORTD, 0 BCF PORTD, 1 BSF PORTB, 2 KLIC SDELAY REP6 KLIC STALL1 BTFSC MSTOP, 0 GOTO STOPS BOPKS, BOTS GOTO REP6 PLUSEMED MOVLW 0XCF MOVWF SPEED11 MOVLW 0XCC MOVWF SPEED12 MOVLW 0XCF MOVWF SPEED21 MOVLW 0XCC MOVWF HITROST 22 KLIK PWM1ON KLIC PWM2ON BCF PORTD, 0 BCF PORT BANKSEL PIR1 BTFSC PIR1, RCIF GOTO RXDATA BTFSS PORTD, 7 GOTO NORMALMED GOTO REP7 GOTO CLROE; ***************************** ************ RMED STATUS BCF, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; KLICNI 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 KLIC PWM1ON KLIC PWM2ON BCF PORTD, 1 BSF PORT 1, BTS BTFSC PIR1, RCIF GOTO RXDATA GOTO REP8 GOTO CLROE; ************************************* **** LMED BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; KLICNI BUTTLEVEL; BTFSC MSTOP, 1; GOTO STOPS CALL DARKLIGHT BTFSC LDET, 0; BSF PORTB, 7 MOVLW MOVWW WWW, MXV, MXV, MXV, MXV, MXV 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; KLIC STALL1; REP9 GOTO CLROE; ***************************************** STANJE BMED BCF, RP0 STANJE BCF, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; KLICNI BUTTLEVEL; BTFSC MSTOP, 1; GOTO STOUS CALL 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 KLIC PWM2ON BSF PORTD, 0 BSF PORTD, 1 BCF PORTB, 2 REPT. REP10 GOTO CLROE; *************************************** FFAST BCF STATUS, RP0 STATUS BCF, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0 BSF MSTOP, 4; KLICNI BUTTLEVEL; BTFSC MSTOP, 1; GOTO STOPS CALL DARKLIGHT BTFSC LDET, 0; BSF PORTB, 7 MOVLW 0XW MOV, MOV, MOV, MOV. MOVWF SPEED21 MOVLW 0X7F MOVWF SPEED22 CALL PWM1ON CALL PWM2ON BCF PORTD, 0 BCF PORTD, 1 BSF PORTB, 1 BSF PORTB, 2 POZIV 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 CALL STALL1 BTFSC MSTOP, 0 GOTO STOPS BANKSEL PIR1 BTFSC PIR1, RCIF GOTO RXDATA NOP BT FDFS PTS AST MOVLW 0XCF MOVWF SPEED12 MOVLW 0XCF MOVWF SPEED21 MOVLW 0XFF MOVWF HITROST 22 KLIK PWM1ON KLIC PSTB, 1 BSF POP., 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 PORTD, 1 BCF PORTB, 2 REPT, POP GOTO REP13 GOTO CLROE; *************************************** LFAST BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; KLICNI BUTTLEVEL; 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 POZIV SDELAY MOVLW 0XFF MOVWF SPEED11 MOVLW 0X4C MOVWF SPEED12 MOVLW 0XEF MOVWF SPEED21 MOVLW 0XB3 MOVWF SPEED22 KLIC PWM1ON KLIC PWM2ON BSF PORTD, 0 BCF PORTD, 1 BSF PORTB, 1 BCF PORTB, 2 REP14 KLIC STALL1 BTFSC MSTOP, 0 GOTO STOPS BOTS BOTS **************************************** BFAST BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; KLICNI BUTTLEV; PWM2ON BSF PORTD, 0 BSF PORTD, 1 BCF PORTB, 1 BCF PORTB, 2 KLICI SDELAY MOVLW 0XEF MOVWF SPEED11 MOVLW 0X66 MOVWF SPEED12 MOVLW 0XEF MOVWF SPEED21 MOVLW 0X66 MOVWFWW SPEED PORTD, 0 BSF PORTD, 1 BCF PORTB, 1 BCF PORTB, 2 REP15 CALL 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; CALL 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 CALL 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 PIR1, BTFSC PIR1 GOTO CLROE; ***************************************** HUP BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0; KLICNI BUTTLEVEL; 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 CALL PWM1OFF CALL PWM2OFF BCF PORTD, 0 BCF PORTD, 1 BCF PORTD, 2 BCF PORTD, 3 BSF MSTOP, 6 REPLF; BANKSEL OPTION_REG; BSF OPTION_REG, 3; BSF OPTION_REG_3, BSF, 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, PCI, 0 BCF PCON, 1 NOP BSF PCON, 0 BSF PCON, 1 BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP CALL 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 BUTTLEVL; 0X66 MOVWF SPEED12 MOVLW 0XFF MOVWF SPEED21 MOVLW 0X99 MOVWF SPEED22 KLIC PWM1ON KLIC PWM2ON BSF PORTD, 0 BCF PORTD, 1 BSF PORTB, 1 BCF PORTB, 2 LR1GREP; KLIC STALL1; 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 MOVF LRTS, 0 SUB REPLF LR2G BCF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP; KLICNI BUTTLEVEL; BTFSC MSTOP, 1; GOTO ZAUSTAVI MOVLW 0XFF MOVWF SPEED11 MOVLW 0X99 MOVWF MEDV. PORTD, 1 BCF PORTB, 1 BSF PORTB, 2 LR2GREP; CALL STALL1; BTFSC MSTOP, 0; GOTO STOPS BANKSEL PIR1 BTFSC PIR1, RCIF GOTO RXDATA CALL LFC1 NOP CALL LFC2 NOP MOVF LRT, 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; *************************** **************** ZAUSTAVITVE BTFSS MSTOP, 4 GOTO STOPA MOVLW 0XCF MOVWF SPEED11 MOVLW 0XB3 MOVWF SPEED12 MOVLW 0XCF MOVWF SPEED21 MOVLW 0XB3 MOVWF SPEED22 CALL PWD POWER PWD 1 KLIC DATUM 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 KLIC PWM1OFF KLIC 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 KLIC PRETVORI MOVF ADRESH, 0 SUBLW 0X70 BTFSS STATUS, C BSF MSTOP2, BCF STATUS, 0 BCF STATUS, 0 BCF STATUS, 0 BCF STATUS, 0 BCF STOP 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 KLIČNI KONVERT MOVF ADRESH, 0 SUBTFS BTS STATUS, RP0 STATUS BCF, RP1 STATUS RETURNBUTTLEVEL BCF, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BANKSEL ADCON0 BCF ADCON0, 3 BCF ADCON0, 4 BSF ADCON0, 5 BCF STATUS, RP0 BCF, RP0 BCF, RP0 BCF BTFSS STATUS, C GOTO BL1 GOTO BL2 BL1 BSF MSTOP, 1 BSF PORTB, 6 BL2 POVRATNA DARKLIGHT BCF STATUS, RP0 BCF STATUS, RP1 BTFSC LDET, 0 GOTO RETFDL BANKSEL ADCON0 BCF ADCON0, 3 BSF ADCON0, 4 BCF ADCON0, 5 BCF STATUS, RP1 KLIKOVANJE PREKLOPI, 0 SUBLW 0XEE BTFSS STATUS, C BSF PONKV. 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 MFWF, RPC BCV 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, BS2 TCC PR2 MOVLW 0XFF MOVWF PR2 BCF STATUS, RP0 BCF STATUS, RP1 MOVF SPEED21, 0 MOVWF CCP2CON MOVF HITROST22, 0 MOVWF CCPR2L BSF STATUS, RP0 BCF STATUS, RP1 MOVLW 0XFCCCFCTFF, RP1 BCOV STOJNIK 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 BCFCFTON, RPF0 5 STATUS BCF, RP0 BCF STATUS, RP1 KLIC PRETVORI MOVF ADRESH, W ANDLW 0XF0 MOVWF LR1 BCF STATUS, RP0 BCF STATUS, RP1 RETURN LFC2 BANKSEL ADCON0 BCF ADCON0, 3 BSF ADCON0, 4 BSF BCF, 4 BSF, BCF RP1 KLIČNI 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 BCF STFUS, RP0 BCF STF 0X4C BTFSC STATUS, C GOTO 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 SOT2 WT2 XL3 POVRATAK NEPOSOBN

Druga nagrada na tekmovanju robotov Instructables in RoboGames

Priporočena: