Talaan ng mga Nilalaman:

Ang Bato: 8 Hakbang
Ang Bato: 8 Hakbang

Video: Ang Bato: 8 Hakbang

Video: Ang Bato: 8 Hakbang
Video: Ang 7 Araw sa Isang Linggo "Pito- Pito" Song by Teacher Cleo Action by: Teacher Kristine Borras 2024, Nobyembre
Anonim
Ang bato
Ang bato

Ang robot na ito ay kinokontrol ng isang visual na pangunahing programa (sa pamamagitan ng serial port), at maaaring ilipat sa tatlong magkakaibang mga bilis ng isang lapad ng pulso na modulated (PWM) signal na nabuo ng isang PIC microcontroller (16F877). Ang robot ay maaaring patakbuhin sa dalawang mga mode, "normal control" at "light tracker" mode. Sa normal na mode ng kontrol, ang robot ay maaaring magdala ng mga bagay na sukat mula 3 - 18 cm mula sa lugar patungo sa isa pa sa loob ng 150 m. samantalang sa light tracker mode, sumusunod ito sa ilaw sa isang madilim na silid. Maraming sensor ang ginamit, tulad ng light sensors; ikiling sensor, stall kasalukuyang sensing, antas ng baterya ng sensing, at ilang mga limitasyon switch at touch sensor na ginamit sa kamay. Mapapanatili nito ang bilis nito palagi kapag ito ay napunta sa isang burol (ikiling) at awtomatikong pinapapatay ang ilaw kapag ito ay naging madilim. Gayundin upang mapanatiling ligtas ang IC, ididiskonekta nito ang kasalukuyang kapag ito ay natigil at huminto ang kamay kapag may hawak na isang bagay. Ang 4 DC motor ay ginamit na kinokontrol ng isang PIC microcontroller 16F877 at 3 motor driver circuit. Tumagal ito ng tungkol sa 4 na buwan, at nagkakahalaga ng halos $ 600

Hakbang 1: Idisenyo ang Proyekto

Idisenyo ang Proyekto
Idisenyo ang Proyekto
Idisenyo ang Proyekto
Idisenyo ang Proyekto

sa paunang yugto, isang disenyo ng proyekto ang ibinigay. pangunahin, pagtukoy sa block diagram; tingnan ang pigura.

Ang isang mas detalyadong Diagram ng Circuit ay kinakailangan sa yugtong ito, subalit, upang mapadali ito, ang pangunahing mga modyul na kinilala ay: 1. Microcontroller 2. Sensors 3. Motors 4. Wireless circuit 5. PC program. Ang isang Disenyo ng 3d ay tapos na rin, tingnan ang pigura.

Hakbang 2: Piliin ang Mga Device at Component

Sa yugtong ito, dapat piliin ng taga-disenyo ang mga aparato at sangkap na kinakailangan upang buuin ang robot.

Kabilang dito: ang mga wireless circuit (MAX232, LM331, FM transmitter at Receiver modules), motor (4 DC motors), motor driver circuit (H-bridge), ang microcontroller PIC (16F877), Battery, Voltage regulator (MC7805), Microswitches, Photoresistors, Tilt sensor … atbp. Ito ay mahalagang maunawaan ang computability ng mga aparatong ito at kung paano sila gumagana nang magkasama.

Hakbang 3: Ang Microcontroller

Ang Microcontroller
Ang Microcontroller

Ang hakbang na ito ang pinakamahalagang hakbang. sa simula, ang mga code na matatanggap at maililipat mula sa PIC ay dapat makilala.

Simulang ikonekta ang mga bahagi sa naaangkop na mga pin ng PIC, at i-program ang microcontroller. Maaaring mangailangan ito upang bumuo ng maliliit na circuit gamit ang mga regulator, resistor, sensor… atbp.

Hakbang 4: Isulat ang Program sa PC

Isulat ang Programa sa PC
Isulat ang Programa sa PC
Isulat ang Programa sa PC
Isulat ang Programa sa PC

Ang programa ay isinulat sa visual basic.

Ang komunikasyon ay itinatag sa pamamagitan ng RS-232. Ang paggamit ng MSComm upang ipadala ang data sa microcontroller sa pamamagitan ng pag-configure ng mga setting (numero ng port, rate ng baud, parity number ng data bits, stop bits). Gumamit ako ng 8-bit data na may isang stop bit at pagkakapareho sa isang baud rate na 9600 bps.

Hakbang 5: Buuin ang Katawan

Buuin ang Katawan
Buuin ang Katawan
Buuin ang Katawan
Buuin ang Katawan

Ang isang mahusay na disenyo ng katawan ay mahalaga. Piliin din ang pag-aayos ng gulong, tingnan ang pigura.

ang robot ay itinayo matapos masiguro ang mga programa na gumagana nang maayos. Ang hakbang na ito ay maaaring gawin bago ang pag-program din.

Hakbang 6: Buuin ang Wireless Circuit

Buuin ang Wireless Circuit
Buuin ang Wireless Circuit

Ang pagtatayo ng wireless circuit ay maaaring malaya. Sa paunang yugto, gumamit ako ng isang kawad upang ikonekta ang PC sa robot, at pagkatapos na tapusin ang robot, isinama ang wireless circuit.

Hakbang 7: Isama

Isama
Isama

Ito ang sandali na isinama namin ang aming mga bahagi, at sinubukan ang robot.

Hakbang 8: Microcontroller Program Code

; ***** p = 16f877 isama ang radix decidlocs "V" << 8 | "1"; Bersyon Hindi lugar ng bangko 0 ram INPUT_VAR L1 L2 X SPEED11 SPEED12 SPEED21 SPEED22 MSTOP LDET LR1 LR2 endc; **** ***** pagsisimula ng pangunahing programa ***** ***** simulan ang BSF STATUS, RP0 BCF STATUS, RP1 MOVLW 0X40 MOVWF ADCON1 MOVLW 0XFF; PORT A IS I MOVWF TRISA MOVLW 0X00; PORT B IS O MOVWF TRISB MOVLW 0XF0; PORT C IS I / O MOVWF TRISC MOVLW 0XF0; PORT D IS I / O TRISD MOVLW 0X07; PORT E IS I MOVWF TRISE BANKSEL OPTION_REG BCF OPTION_REG, T0CS BCF STATUS, RP1 BCF STATUS, RP0; ***** ***** ***** ************ WAIT 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, SPEN BTFSC RCSTA, 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, RCIF GOTO WAIT1 BCF MSTOP, BCF MSTOP, BCF MSTOP, BCF MSTOP, BCF MSTOP, BCF MSTOP, BCF MSTOP CALL PWM1OFF CALL PWM2OFF CALL DARKLIGHT BTFSC LDET, 0 BSF PORTB, 7RXDATA; BANKSEL RCSTA; BTFSC RCSTA, OERR; GOTO STOPS CALL PWM1OFF CALL PWM2OFF CALL DARKLIGHT BTFSC PORTEL, RCF BRE, 1 BCF, RCF 0; ***** *** STATUS, RP1 MOVF INPUT_VAR, 0; STOP SUBLW 0X53 BTFSC STATUS, Z GOTO STOPS MOVF INPUT_VAR, 0; LIGHT ON SUBLW 0X4E BTFSC STATUS, Z GOTO LON MOVF INPUT_VAR, 0; LIGHT OFF SUBLW 0X51 BTFSOTO STATUS, 0; MOVE FORWARD SLOW SUBLW 0X66 BTFSC STATUS, Z GOTO FSLOW MOVF INPUT_VAR, 0; MOVE RIGHT SLOW SUBLW 0X72 BTFSC STATUS, Z GOTO RSLOW MOVF INPUT_VAR, 0; MOVE LEFT SLOW SUBLW 0 X6C BTFSC STATUS, Z GOTO LSLOW MOVF INPUT_VAR, 0; MOVE BACKWARD SLOW SUBLW 0X62 BTFSC STATUS, Z GOTO BSLOW MOVF INPUT_VAR, 0; MOVE FORWARD MEDIUM SUBLW 0X46 BTFSC STATUS, Z GOTO FMEAR MOVS 0L MOV2 STATUS, Z GOTO RMED MOVF INPUT_VAR, 0; MOVE LEFT MEDIUM SUBLW 0X4C BTFSC STATUS, Z GOTO LMED MOVF INPUT_VAR, 0; MOVE BACKWARD MEDIUM SUBLW 0X42 BTFSC STATUS, Z GOTO BMED MOVF INPUT_VAR 0X, SUBUS, 055 Z GOTO FFAST MOVF INPUT_VAR, 0; MOVE RIGHT FAST SUBLW 0X57 BTFSC STATUS, Z GOTO RFAST MOVF INPUT_VAR, 0; MOVE LEFT FAST SUBLW 0X56 BTFSC STATUS, Z GOTO LFAST MOVF INPUT_VAR, 0; MOVE BACKWARD FAST SUBLW BFAST MOVF INPUT_VAR, 0; HAND CLOSE SUBLW 0X43 BTFSC STATUS, Z GOTO HCLOSE MOVF INPUT_VAR, 0; HAND OPEN SUBLW 0X4F BTFSC STATUS, Z GOTO HOPEN MOVF INPUT_VAR, 0; HAND UP SUBLW 0X75 BTFSOTO HUWAG,; HAND Down SUBLW 0X64 BTFSC STATUS, Z GOTO HDOWN MOVF INPUT_VAR, 0; LIGHT FOLOWE R SUBLW 0X54 BTFSC STATUS, Z GOTO LFOLLOW; ***** ***; ***** 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; BTFSC MSTOP, 1; GOTO STLPS CFS DFS LDET, 0; BSF PORTB, 7 NORMALSLOW MOVLW 0XFF MOVWF SPEED11 MOVLW 0X66 MOVWF SPEED12 MOVLW 0XFF MOVWF SPEED21 MOVLW 0X66 MovWF SPEED22 CALL PWM1ON CALL PWM2ON BCF PORTD, 0 BCF PORTD, 1 BSF PORTD, 1 BSF PORTD, 1 BSF PORTD, 1 BSF PORTD, 1 BSF PORTD, 1 BSF PORTD, 1 BSF PORTD, RCIF GOTO RXDATA GOTO REP3 GOTO CLROE; ***************************************** ** LSLOW 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 0XFF MOVWF SPEED11 MOVLF SPEED12 MOVLW 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; ***************************** ***** 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 PORTB, 1 BSF PORTB, 2 PORA GIRA BRAKS, 2 PIRA GIRA BRAKS, 2 PORA GUI BRAKS *** MSTOP, 1; GOTO STOPS CALL DARKLIGHT BTFSC LDET, 0; BSF PORTB, 7 MOVLW 0XCF MOVWF SPEED11 MOVLW 0X99 MOVWF SPEED12 MOVLW 0XCF MOVWF SPEED21 MOVLW 0X99 MOVWF SPEED22 CALL PWM1ON BCF PFM2ON BCF PFM2ON BCF PFM2ON BCF PFM2ON BCF PFM2ON BCF PFM2ON BCF PFM2ON BCF PFM2ON BCF 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; CALL BUTTLEVEL; BTFSC MSTOP, 1; GOTO STOPS CALL DARKLIGHT BTFSC LDET, 0; BSF PORTB, 7 NORMALMED MOVLW 0XFF MOVWF SPEED11 MOVEFEFEX1 MOVEF 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 GOTO STOPS BANKSEL PIR1 GOTO REP6 PLUSEMED 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 BSF PORTB, 1 BSF PORTB, 1 BSF PORTB, 1 BSF PORTB 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 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 PFSCSTO BALL BALL, 2 REBLS BALL BALL, 2 BCF PFSB, STALL BALL BALL, 2 BCF PORTC BTFSC PIR1, RCIF GOTO RXDATA GOTO REP8 GOTO CLROE; ************************************* **** LMED 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 MOVLW 0XFF MOVWF SPEED11 MOVFW 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; CALL STALL1; BTFSC MSTOP, 0; GOTO PIRS BIRKS REP9 GOTO CLROE; *****, 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 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, 1 BCF PORTB, 2 REP10 CALL STALL1 BTFSC MIROP1 REP10 GOTO CLROE; *****, RP0 BCF STATUS, RP1 MOVLW 0X00 MOVWF MSTOP BCF LDET, 0 BSF MSTOP, 4; CALL BUTTLEVEL; BTFSC MSTOP, 1; GOTO STOPS CALL DARKLIGHT BTFSC LDET, 0; BSF PORTB, 7 MOVLW 0XEF MOVWF SPEEDF MOVEFFX 0W movwf SPEED21 MOVLW 0X7F movwf SPEED22 tAWAG PWM1ON tAWAG PWM2ON BCF PORTD, 0 BCF PORTD, 1 BSF PORTB, 1 BSF PORTB, 2 tAWAG sdelay NORMALFAST MOVLW 0XCF movwf SPEED11 MOVLW 0XCC movwf SPEED12 MOVLW 0XCF movwf SPEED21 MOVLW 0XCC movwf SPEED22 tAWAG PWM1ON tAWAG 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 BTFSS PORTD, 7 GOTO REP11 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 PORTD, 1 BSF PORTB, 1 BSP PORSA BALLS, BALL BALL BST, 1 BF BST BST BST, BF BST BST BST, 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 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 REP13 CALL STALL1 BTFSC MST GOTO REP13 GOTO CLROE; ***************************************** LFAST 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 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 PWSFW 0 0XEF MOVWF SPEED21 MOVLW 0XB3 MOVWF SPEED22 CALL PWM1ON CALL PWM2ON BSF PORTD, 0 BCF PORTD, 1 BSF PORTB, 1 BCF PORTB, 2 REP14 CALL STALL1 BTFSC MSTOP, 0 GOTO STOPS BANKSEL PIR1 GALIKA GRA1 ***** RP1 MOVLW 0x00 movwf MSTOP BCF LDET, 0; tAWAG BUTTLEVEL; BTFSC MSTOP, 1; GOTO tumitigil tAWAG Darklight BTFSC LDET, 0; BSF PORTB, 7 MOVLW 0XDF movwf SPEED11 MOVLW 0X99 movwf SPEED12 MOVLW 0XDF movwf SPEED21 MOVLW 0X99 movwf SPEED22 tAWAG PWM1ON tAWAG PWM2ON BSF PORTD, 0 BSF PORTD, 1 BCF PORTB, 1 BCF PORTB, 2 TUMAWAG SDELAY MOVLW 0XEF MOVWF SPEED11 MOVLW 0X66 MOVWF SPEED12 MOVLW 0XEF MOVWF SPEED21 MOVLW 0X66 MOVWF SPEEDON CALL PWM1 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; ************* ***; 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 STOPS BTFSC PORTD 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, RCIF GOTO RX17 GOTO CLROE; ***** 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, 4 GOTO STOPS BCF PORTC, 0 BSF PORTC, 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; ***** ***** ***** *** ***** 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_REGION, 3F; BSF OPTION_REG, 3F;, 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 BANKSON PC, 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, Z GOTO FRONT CALL 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 BUTTLEVEL; BTFSC MSTOP, 1WLLFX 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 LR1GREP; CALL STALL1; BTFSC MST, 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 LR2, 0 SUBWF LRATUS, 0 BTFSS GOTO REPLF LR2G BCF KALAGAYAN, RP0 BCF KALAGAYAN, RP1 MOVLW 0x00 movwf MSTOP; tAWAG BUTTLEVEL; BTFSC MSTOP, 1; GOTO hinto MOVLW 0xFF movwf SPEED11 MOVLW 0X99 movwf SPEED12 MOVLW 0xFF movwf SPEED21 MOVLW 0X66 movwf SPEED22 tAWAG PWM1ON tAWAG PWM2ON BCF PORTD, 0 BSF 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 LR2, 0 SUBWF LRAT, 0 BTWF LRAT 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; CALL BUTTLEVEL; BTFSL MSTOP, 1 MOVFF 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 MSTOP, 3; GOTO STOPS CALL LFC1 NOP CALL LFC2 NOP MOVF LR2, 0 SUBWF LR1, 0 BTFSC STATUS, Z GOTO FROREP GOTO REPLF GOTO CLROE; ************************* *** 1 CALL 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 BCF PORTD, 0 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 CALL CONVERT MOVF ADRESH, 0 SUBLW 0X70 BTFSS STATUS, C BSF MSTOP, 0 BCF STATUS, RP0 BCF BCF BCF 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 CALL CONVERT MovF ADRESH, 0 SUBLW 0X40 BTFF STATST 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 BCF STATUS, RP0 BCF STATUSX, 0 BF CF, 0 BTFSS STATUS, C GOTO BL1 GOTO BL2 BL1 BSF MSTOP, 1 BSF PORTB, 6 BL2 RETURN 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, RP0 BCF STATUS, RP1 CALL CONVERT MOVF ADRESH, 0 SUBLW 0XEE BTFSS STATUS, C BSF PORTB, 7 RETFDL BANSA1 BANSA1 BANSLAN BANSA NG BANSA NG BANSA NG BANSA NG BANSA NG BANSA NG BANSA NG BANSA NG BF 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 0XFF MOVWF PR2 BCF STATUS, RPF STATUS 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 2FCF BSF 2FBF BSF 2F 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 MOVLW 0XF0 MOVWF TRISC BCF STATUS BCF BCF BCF 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 KALAGAYAN, RP1 BCF KALAGAYAN, 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 STATS, AD00 ADF, AD01 ADF, AD01 ADF, AD110 ADF 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 ADCON0, 4 BSF ADCON0, 5 BCF ADCON0, 5 BCF ADCON0, 5 BCF ADCON0, 5 BCF ADCON0, 5 BCF ADCON0, 5 BCF STCUS0, RP1 CALL CONVERT MOVF ADRESH, 0 ANDLW 0XF0 MOVWF LR2 BCF STATUS, RP0 BCF STATUS, RP1 RETURN LDIN BANKSEL ADCON0 BCF ADCON0, 3 BSF ADCON0, 4 BCF ADCON0, 5 BCF STATUS, RP0 BCF STRUS, SUBF CALL 0X4C BTFSC STATUS, C GOTO COMP4 BSF MSTOP, 3 COMP4 BCF STATUS, RP0 BCF STATUS, RP1 RETURN 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 XL2 MOVLW 0X10 INCF L2 SUBFF XL3 RETURN NOP NOPEND

Pangalawang Gantimpala sa Mga Instructable at RoboGames Robot Contest

Inirerekumendang: