Blame | Last modification | View Log | Download
CCS PCM C Compiler, Version 3.245, 27853 17-IV-06 12:46
Filename: D:\KAKLIK\programy\PIC_C\roboti\istrobot\3Orbis\main.lst
ROM used: 849 words (21%)
Largest free fragment is 2048
RAM used: 27 (15%) at main() level
34 (19%) worst case
Stack: 4 worst case (2 in main + 2 for interrupts)
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 1E3
0003: NOP
0004: MOVWF 7F
0005: SWAPF 03,W
0006: CLRF 03
0007: MOVWF 21
0008: MOVF 7F,W
0009: MOVWF 20
000A: MOVF 0A,W
000B: MOVWF 28
000C: CLRF 0A
000D: SWAPF 20,F
000E: MOVF 04,W
000F: MOVWF 22
0010: MOVF 77,W
0011: MOVWF 23
0012: MOVF 78,W
0013: MOVWF 24
0014: MOVF 79,W
0015: MOVWF 25
0016: MOVF 7A,W
0017: MOVWF 26
0018: MOVF 7B,W
0019: MOVWF 27
001A: BCF 03.7
001B: BCF 03.5
001C: MOVLW 8C
001D: MOVWF 04
001E: BTFSS 00.1
001F: GOTO 022
0020: BTFSC 0C.1
0021: GOTO 035
0022: MOVF 22,W
0023: MOVWF 04
0024: MOVF 23,W
0025: MOVWF 77
0026: MOVF 24,W
0027: MOVWF 78
0028: MOVF 25,W
0029: MOVWF 79
002A: MOVF 26,W
002B: MOVWF 7A
002C: MOVF 27,W
002D: MOVWF 7B
002E: MOVF 28,W
002F: MOVWF 0A
0030: SWAPF 21,W
0031: MOVWF 03
0032: SWAPF 7F,F
0033: SWAPF 7F,W
0034: RETFIE
0035: BCF 0A.3
0036: GOTO 047
.................... #include ".\main.h"
.................... #include <16F88.h>
.................... //////// Standard Header file for the PIC16F88 device ////////////////
.................... #device PIC16F88
.................... #list
....................
.................... #device adc=8
....................
.................... #FUSES NOWDT //No Watch Dog Timer
.................... #FUSES INTRC_IO
.................... #FUSES NOPUT //No Power Up Timer
.................... #FUSES MCLR //Master Clear pin enabled
.................... #FUSES NOBROWNOUT //Reset when brownout detected
.................... #FUSES NOLVP //Low Voltage Programming on B3(PIC16) or B5(PIC18)
.................... #FUSES NOCPD //No EE protection
.................... #FUSES NOWRT //Program memory not write protected
.................... #FUSES NODEBUG //No Debug mode for ICD
.................... #FUSES NOPROTECT //Code not protected from reading
.................... #FUSES NOFCMEN //Fail-safe clock monitor enabled
.................... #FUSES NOIESO //Internal External Switch Over mode enabled
....................
.................... #use delay(clock=8000000,RESTART_WDT)
0037: MOVLW 08
0038: SUBWF 3C,F
0039: BTFSS 03.0
003A: GOTO 046
003B: MOVLW 3C
003C: MOVWF 04
003D: BCF 03.0
003E: RRF 00,F
003F: MOVF 00,W
0040: BTFSC 03.2
0041: GOTO 046
0042: GOTO 044
0043: CLRWDT
0044: DECFSZ 00,F
0045: GOTO 043
0046: RETLW 00
*
0065: MOVLW 39
0066: MOVWF 04
0067: MOVF 00,W
0068: BTFSC 03.2
0069: GOTO 07C
006A: MOVLW 02
006B: MOVWF 78
006C: MOVLW BF
006D: MOVWF 77
006E: CLRWDT
006F: DECFSZ 77,F
0070: GOTO 06E
0071: DECFSZ 78,F
0072: GOTO 06C
0073: MOVLW 96
0074: MOVWF 77
0075: DECFSZ 77,F
0076: GOTO 075
0077: NOP
0078: NOP
0079: CLRWDT
007A: DECFSZ 00,F
007B: GOTO 06A
007C: RETLW 00
....................
....................
....................
.................... #define KOLMO1 225 // predni kolecko sroubem dopredu
.................... #define KOLMO2 30 // predni kolecko je hlavou sroubu dozadu
.................... #define STRED 128 // sredni poloha zataceciho kolecka
.................... #define BEAR1 12 // 3 stupne zataceni
.................... #define BEAR2 34
.................... #define BEAR3 55
.................... #define SPEEDMAX 140 // maximalni rychlost
....................
.................... #define L 1 // cara vlevo
.................... #define S 2 // casa mezi sensory
.................... #define R 0 // cara vpravo
....................
.................... // servo
.................... #define SERVO PIN_A2
....................
.................... // IR
.................... #define IRTX PIN_B2
.................... #define CIHLA PIN_A3
....................
.................... //motory
.................... #define FR output_low(PIN_A7); output_high(PIN_A6) // Vpred
.................... #define FL output_low(PIN_A1); output_high(PIN_A0)
.................... #define BR output_low(PIN_A6); output_high(PIN_A7) // Vzad
.................... #define BL output_low(PIN_A0); output_high(PIN_A1)
.................... #define STOPR output_low(PIN_A6);output_low(PIN_A7)
.................... #define STOPL output_low(PIN_A0);output_low(PIN_A1)
....................
.................... //HID
.................... #define LED1 PIN_B1 //oranzova
.................... #define LED2 PIN_B2 //zluta
....................
.................... #define STROBE PIN_B0
.................... //#define SW1 PIN_A2 // Motory On/off
....................
.................... unsigned int8 sensors; // pomocna promenna pro cteni cidel na caru
.................... unsigned int8 line; // na ktere strane byla detekovana cara
.................... //unsigned int8 dira; // pocita dobu po kterou je ztracena cara
.................... unsigned int8 uhel; // urcuje aktualni uhel zataceni
.................... //unsigned int8 speed; // maximalni povolena rychlost
.................... unsigned int8 rovinka; // pocitadlo na zjisteni rovinky
....................
.................... signed int16 Lmotor; // promene, ktere urcuji velikost vykonu na levem
.................... signed int16 Rmotor; // a pravem motoru
....................
.................... // makro pro PWM pro motory
.................... #define GO(motor, direction, power) if(get_timer0()<=power) \
.................... {direction##motor;} else {stop##motor;}
....................
.................... ////////////////////////////////////////////////////////////////////////////////
.................... /*
.................... void diagnostika()
.................... {
.................... if(input(SW1))STOPR;STOPL;While(TRUE);
.................... // if(LSENSOR==true) output_high(LED2); else output_low(LED2);
.................... // if(RSENSOR==true) output_high(LED1); else output_low(LED1);
.................... }
.................... */
.................... ////////////////////////////////////////////////////////////////////////////////
.................... #int_TIMER2
.................... TIMER2_isr() // ovladani serva
.................... {
.................... unsigned int8 n;
....................
.................... output_high(SERVO);
*
0047: BSF 03.5
0048: BCF 05.2
0049: BCF 03.5
004A: BSF 05.2
.................... delay_us(1000);
004B: CLRWDT
004C: MOVLW 09
004D: MOVWF 3B
004E: MOVLW 6D
004F: MOVWF 3C
0050: CALL 037
0051: DECFSZ 3B,F
0052: GOTO 04E
.................... for(n=uhel; n>0; n--) Delay_us(2);
0053: MOVF 2C,W
0054: MOVWF 3A
0055: MOVF 3A,F
0056: BTFSC 03.2
0057: GOTO 05E
0058: CLRWDT
0059: NOP
005A: NOP
005B: NOP
005C: DECF 3A,F
005D: GOTO 055
.................... output_low(SERVO);
005E: BSF 03.5
005F: BCF 05.2
0060: BCF 03.5
0061: BCF 05.2
.................... }
....................
.................... ////////////////////////////////////////////////////////////////////////////////
0062: BCF 0C.1
0063: BCF 0A.3
0064: GOTO 022
.................... short int IRcheck() // potvrdi detekci cihly
.................... {
.................... output_high(IRTX); // vypne vysilac IR
.................... delay_ms(100);
....................
.................... output_low(STROBE);
.................... sensors = spi_read(0); // cteni senzoru
.................... sensors=~sensors;
.................... output_high(STROBE);
....................
.................... if(true==bit_test(sensors,7)) // otestuje, jestli je stale detekovan IR signal
.................... {
.................... output_low(IRTX); // zapne vysilac IR
.................... delay_ms(100);
....................
.................... output_low(STROBE);
.................... sensors = spi_read(0); // cteni senzoru
.................... sensors=~sensors;
.................... output_high(STROBE);
....................
.................... if(false==bit_test(sensors,7)) // otestuje, jestli je detekovana cihla
.................... {
.................... output_high(IRTX); // vypne vysilac IR
.................... delay_ms(100);
....................
.................... output_low(STROBE);
.................... sensors = spi_read(0); // cteni senzoru
.................... sensors=~sensors;
.................... output_high(STROBE);
....................
.................... output_low(IRTX); // zapne vysilac IR
.................... if(bit_test(sensors,7)) return 1; // vrat 1, kdyz je stale cihla
.................... }
.................... };
.................... output_low(IRTX); // zapne vysilac IR
.................... return 0; // vrat 0, kdyz je detekovano ruseni
.................... }
.................... ////////////////////////////////////////////////////////////////////////////////
.................... void objizdka()
.................... {
.................... int8 shure=0;
*
007D: CLRF 35
.................... unsigned int16 n;
....................
.................... BR;BL;
007E: BSF 03.5
007F: BCF 05.6
0080: BCF 03.5
0081: BCF 05.6
0082: BSF 03.5
0083: BCF 05.7
0084: BCF 03.5
0085: BSF 05.7
0086: BSF 03.5
0087: BCF 05.0
0088: BCF 03.5
0089: BCF 05.0
008A: BSF 03.5
008B: BCF 05.1
008C: BCF 03.5
008D: BSF 05.1
.................... Delay_ms(400);
008E: MOVLW 02
008F: MOVWF 38
0090: MOVLW C8
0091: MOVWF 39
0092: CALL 065
0093: DECFSZ 38,F
0094: GOTO 090
.................... STOPR;STOPL;
0095: BSF 03.5
0096: BCF 05.6
0097: BCF 03.5
0098: BCF 05.6
0099: BSF 03.5
009A: BCF 05.7
009B: BCF 03.5
009C: BCF 05.7
009D: BSF 03.5
009E: BCF 05.0
009F: BCF 03.5
00A0: BCF 05.0
00A1: BSF 03.5
00A2: BCF 05.1
00A3: BCF 03.5
00A4: BCF 05.1
....................
.................... uhel=KOLMO1; // nastav zataceci kolecko kolmo na osu robota
00A5: MOVLW E1
00A6: MOVWF 2C
.................... Delay_ms(100);
00A7: MOVLW 64
00A8: MOVWF 39
00A9: CALL 065
.................... BL;FR;
00AA: BSF 03.5
00AB: BCF 05.0
00AC: BCF 03.5
00AD: BCF 05.0
00AE: BSF 03.5
00AF: BCF 05.1
00B0: BCF 03.5
00B1: BSF 05.1
00B2: BSF 03.5
00B3: BCF 05.7
00B4: BCF 03.5
00B5: BCF 05.7
00B6: BSF 03.5
00B7: BCF 05.6
00B8: BCF 03.5
00B9: BSF 05.6
.................... Delay_ms(200); // minimalni toceni, kdyby se zastavilo sikmo k cihle
00BA: MOVLW C8
00BB: MOVWF 39
00BC: CALL 065
....................
.................... While(bit_test(sensors,7)) // toc, dokud neni cihla z primeho senzoru
.................... {
00BD: BTFSS 2A.7
00BE: GOTO 0CE
.................... sensors = spi_read(0); // cteni senzoru
00BF: MOVF 13,W
00C0: CLRF 13
00C1: BSF 03.5
00C2: BTFSC 14.0
00C3: GOTO 0C6
00C4: BCF 03.5
00C5: GOTO 0C1
00C6: BCF 03.5
00C7: MOVF 13,W
00C8: MOVWF 2A
.................... sensors=~sensors;
00C9: COMF 2A,F
.................... Delay_ms(4); // cekani na SLAVE nez pripravi data od cidel
00CA: MOVLW 04
00CB: MOVWF 39
00CC: CALL 065
.................... }
00CD: GOTO 0BD
.................... STOPL; STOPR;
00CE: BSF 03.5
00CF: BCF 05.0
00D0: BCF 03.5
00D1: BCF 05.0
00D2: BSF 03.5
00D3: BCF 05.1
00D4: BCF 03.5
00D5: BCF 05.1
00D6: BSF 03.5
00D7: BCF 05.6
00D8: BCF 03.5
00D9: BCF 05.6
00DA: BSF 03.5
00DB: BCF 05.7
00DC: BCF 03.5
00DD: BCF 05.7
....................
.................... for (n=0;n<1500;n++) // vystred se na hranu cihly
00DE: CLRF 37
00DF: CLRF 36
00E0: MOVF 37,W
00E1: SUBLW 05
00E2: BTFSS 03.0
00E3: GOTO 117
00E4: BTFSS 03.2
00E5: GOTO 0EA
00E6: MOVF 36,W
00E7: SUBLW DB
00E8: BTFSS 03.0
00E9: GOTO 117
.................... {
.................... if(!input(CIHLA)) {BL; FR;} else {FL; BR;};
00EA: BSF 03.5
00EB: BSF 05.3
00EC: BCF 03.5
00ED: BTFSC 05.3
00EE: GOTO 100
00EF: BSF 03.5
00F0: BCF 05.0
00F1: BCF 03.5
00F2: BCF 05.0
00F3: BSF 03.5
00F4: BCF 05.1
00F5: BCF 03.5
00F6: BSF 05.1
00F7: BSF 03.5
00F8: BCF 05.7
00F9: BCF 03.5
00FA: BCF 05.7
00FB: BSF 03.5
00FC: BCF 05.6
00FD: BCF 03.5
00FE: BSF 05.6
00FF: GOTO 110
0100: BSF 03.5
0101: BCF 05.1
0102: BCF 03.5
0103: BCF 05.1
0104: BSF 03.5
0105: BCF 05.0
0106: BCF 03.5
0107: BSF 05.0
0108: BSF 03.5
0109: BCF 05.6
010A: BCF 03.5
010B: BCF 05.6
010C: BSF 03.5
010D: BCF 05.7
010E: BCF 03.5
010F: BSF 05.7
.................... delay_ms(1);
0110: MOVLW 01
0111: MOVWF 39
0112: CALL 065
.................... }
0113: INCF 36,F
0114: BTFSC 03.2
0115: INCF 37,F
0116: GOTO 0E0
.................... STOPR;STOPL;
0117: BSF 03.5
0118: BCF 05.6
0119: BCF 03.5
011A: BCF 05.6
011B: BSF 03.5
011C: BCF 05.7
011D: BCF 03.5
011E: BCF 05.7
011F: BSF 03.5
0120: BCF 05.0
0121: BCF 03.5
0122: BCF 05.0
0123: BSF 03.5
0124: BCF 05.1
0125: BCF 03.5
0126: BCF 05.1
....................
.................... uhel=STRED; // dopredu
0127: MOVLW 80
0128: MOVWF 2C
.................... delay_ms(100);
0129: MOVLW 64
012A: MOVWF 39
012B: CALL 065
.................... FR; FL;
012C: BSF 03.5
012D: BCF 05.7
012E: BCF 03.5
012F: BCF 05.7
0130: BSF 03.5
0131: BCF 05.6
0132: BCF 03.5
0133: BSF 05.6
0134: BSF 03.5
0135: BCF 05.1
0136: BCF 03.5
0137: BCF 05.1
0138: BSF 03.5
0139: BCF 05.0
013A: BCF 03.5
013B: BSF 05.0
.................... delay_ms(500);
013C: MOVLW 02
013D: MOVWF 38
013E: MOVLW FA
013F: MOVWF 39
0140: CALL 065
0141: DECFSZ 38,F
0142: GOTO 13E
.................... BL;BR;
0143: BSF 03.5
0144: BCF 05.0
0145: BCF 03.5
0146: BCF 05.0
0147: BSF 03.5
0148: BCF 05.1
0149: BCF 03.5
014A: BSF 05.1
014B: BSF 03.5
014C: BCF 05.6
014D: BCF 03.5
014E: BCF 05.6
014F: BSF 03.5
0150: BCF 05.7
0151: BCF 03.5
0152: BSF 05.7
.................... delay_ms(200);
0153: MOVLW C8
0154: MOVWF 39
0155: CALL 065
.................... STOPL;STOPR;
0156: BSF 03.5
0157: BCF 05.0
0158: BCF 03.5
0159: BCF 05.0
015A: BSF 03.5
015B: BCF 05.1
015C: BCF 03.5
015D: BCF 05.1
015E: BSF 03.5
015F: BCF 05.6
0160: BCF 03.5
0161: BCF 05.6
0162: BSF 03.5
0163: BCF 05.7
0164: BCF 03.5
0165: BCF 05.7
....................
.................... uhel=STRED+BEAR3; // doprava
0166: MOVLW B7
0167: MOVWF 2C
.................... delay_ms(100);
0168: MOVLW 64
0169: MOVWF 39
016A: CALL 065
.................... FL;
016B: BSF 03.5
016C: BCF 05.1
016D: BCF 03.5
016E: BCF 05.1
016F: BSF 03.5
0170: BCF 05.0
0171: BCF 03.5
0172: BSF 05.0
.................... delay_ms(200);
0173: MOVLW C8
0174: MOVWF 39
0175: CALL 065
.................... uhel=STRED+BEAR2; // min doprava
0176: MOVLW A2
0177: MOVWF 2C
.................... FL;FR;
0178: BSF 03.5
0179: BCF 05.1
017A: BCF 03.5
017B: BCF 05.1
017C: BSF 03.5
017D: BCF 05.0
017E: BCF 03.5
017F: BSF 05.0
0180: BSF 03.5
0181: BCF 05.7
0182: BCF 03.5
0183: BCF 05.7
0184: BSF 03.5
0185: BCF 05.6
0186: BCF 03.5
0187: BSF 05.6
.................... delay_ms(200);
0188: MOVLW C8
0189: MOVWF 39
018A: CALL 065
.................... uhel=STRED+BEAR1; // jeste min doprava
018B: MOVLW 8C
018C: MOVWF 2C
.................... FL;FR;
018D: BSF 03.5
018E: BCF 05.1
018F: BCF 03.5
0190: BCF 05.1
0191: BSF 03.5
0192: BCF 05.0
0193: BCF 03.5
0194: BSF 05.0
0195: BSF 03.5
0196: BCF 05.7
0197: BCF 03.5
0198: BCF 05.7
0199: BSF 03.5
019A: BCF 05.6
019B: BCF 03.5
019C: BSF 05.6
.................... delay_ms(200);
019D: MOVLW C8
019E: MOVWF 39
019F: CALL 065
.................... uhel=STRED; // rovne
01A0: MOVLW 80
01A1: MOVWF 2C
.................... FL;FR;
01A2: BSF 03.5
01A3: BCF 05.1
01A4: BCF 03.5
01A5: BCF 05.1
01A6: BSF 03.5
01A7: BCF 05.0
01A8: BCF 03.5
01A9: BSF 05.0
01AA: BSF 03.5
01AB: BCF 05.7
01AC: BCF 03.5
01AD: BCF 05.7
01AE: BSF 03.5
01AF: BCF 05.6
01B0: BCF 03.5
01B1: BSF 05.6
.................... delay_ms(100);
01B2: MOVLW 64
01B3: MOVWF 39
01B4: CALL 065
.................... While((sensors & 0b01111111)!=0) //dokud neni cara
.................... {
01B5: MOVF 2A,W
01B6: ANDLW 7F
01B7: BTFSC 03.2
01B8: GOTO 1C8
.................... sensors = spi_read(0); // cteni senzoru
01B9: MOVF 13,W
01BA: CLRF 13
01BB: BSF 03.5
01BC: BTFSC 14.0
01BD: GOTO 1C0
01BE: BCF 03.5
01BF: GOTO 1BB
01C0: BCF 03.5
01C1: MOVF 13,W
01C2: MOVWF 2A
.................... sensors=~sensors;
01C3: COMF 2A,F
.................... Delay_ms(4); // cekani na SLAVE nez pripravi data od cidel
01C4: MOVLW 04
01C5: MOVWF 39
01C6: CALL 065
.................... }
01C7: GOTO 1B5
.................... BL; BR;
01C8: BSF 03.5
01C9: BCF 05.0
01CA: BCF 03.5
01CB: BCF 05.0
01CC: BSF 03.5
01CD: BCF 05.1
01CE: BCF 03.5
01CF: BSF 05.1
01D0: BSF 03.5
01D1: BCF 05.6
01D2: BCF 03.5
01D3: BCF 05.6
01D4: BSF 03.5
01D5: BCF 05.7
01D6: BCF 03.5
01D7: BSF 05.7
.................... delay_ms(400);
01D8: MOVLW 02
01D9: MOVWF 38
01DA: MOVLW C8
01DB: MOVWF 39
01DC: CALL 065
01DD: DECFSZ 38,F
01DE: GOTO 1DA
....................
.................... uhel=STRED-BEAR3; // doleva
01DF: MOVLW 49
01E0: MOVWF 2C
.................... }
01E1: BCF 0A.3
01E2: GOTO 2D1 (RETURN)
....................
.................... ////////////////////////////////////////////////////////////////////////////////
.................... void main()
.................... {
01E3: CLRF 04
01E4: MOVLW 1F
01E5: ANDWF 03,F
01E6: MOVLW 70
01E7: BSF 03.5
01E8: MOVWF 0F
01E9: BCF 1F.4
01EA: BCF 1F.5
01EB: MOVF 1B,W
01EC: ANDLW 80
01ED: MOVWF 1B
01EE: MOVLW 07
01EF: MOVWF 1C
....................
.................... unsigned int16 n;
.................... unsigned int8 i;
....................
.................... setup_adc_ports(NO_ANALOGS);
01F0: BCF 1F.4
01F1: BCF 1F.5
01F2: MOVF 1B,W
01F3: ANDLW 80
01F4: MOVWF 1B
.................... setup_adc(ADC_CLOCK_INTERNAL);
01F5: BCF 1F.6
01F6: BCF 03.5
01F7: BSF 1F.6
01F8: BSF 1F.7
01F9: BSF 03.5
01FA: BCF 1F.7
01FB: BCF 03.5
01FC: BSF 1F.0
.................... setup_spi(SPI_MASTER|SPI_H_TO_L|SPI_XMIT_L_TO_H|SPI_CLK_DIV_4);
01FD: BCF 14.5
01FE: BSF 03.5
01FF: BCF 06.2
0200: BSF 06.1
0201: BCF 06.4
0202: MOVLW 30
0203: BCF 03.5
0204: MOVWF 14
0205: MOVLW 00
0206: BSF 03.5
0207: MOVWF 14
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
0208: MOVF 01,W
0209: ANDLW C7
020A: IORLW 08
020B: MOVWF 01
.................... setup_timer_1(T1_DISABLED);
020C: BCF 03.5
020D: CLRF 10
.................... setup_timer_2(T2_DIV_BY_16,140,16);
020E: MOVLW 78
020F: MOVWF 78
0210: IORLW 06
0211: MOVWF 12
0212: MOVLW 8C
0213: BSF 03.5
0214: MOVWF 12
.................... setup_oscillator(OSC_8MHZ|OSC_INTRC);
0215: MOVLW 72
0216: MOVWF 0F
....................
.................... STOPR; STOPL; // zastav motory
0217: BCF 05.6
0218: BCF 03.5
0219: BCF 05.6
021A: BSF 03.5
021B: BCF 05.7
021C: BCF 03.5
021D: BCF 05.7
021E: BSF 03.5
021F: BCF 05.0
0220: BCF 03.5
0221: BCF 05.0
0222: BSF 03.5
0223: BCF 05.1
0224: BCF 03.5
0225: BCF 05.1
.................... Lmotor=0;Rmotor=0;
0226: CLRF 2F
0227: CLRF 2E
0228: CLRF 31
0229: CLRF 30
....................
.................... uhel=STRED; // nastav zadni kolecko na stred
022A: MOVLW 80
022B: MOVWF 2C
.................... rovinka=0;
022C: CLRF 2D
....................
.................... enable_interrupts(INT_TIMER2);
022D: BSF 03.5
022E: BSF 0C.1
.................... enable_interrupts(GLOBAL);
022F: MOVLW C0
0230: BCF 03.5
0231: IORWF 0B,F
....................
.................... output_low(IRTX); // zapni IR vysilac
0232: BSF 03.5
0233: BCF 06.2
0234: BCF 03.5
0235: BCF 06.2
....................
.................... delay_ms(1000);
0236: MOVLW 04
0237: MOVWF 35
0238: MOVLW FA
0239: MOVWF 39
023A: CALL 065
023B: DECFSZ 35,F
023C: GOTO 238
....................
.................... while(true)
.................... {
....................
.................... GO(L,F,Lmotor);GO(R,F,Rmotor); // zapni motory
023D: MOVF 01,W
023E: BTFSS 00.7
023F: GOTO 243
0240: BTFSS 2F.7
0241: GOTO 24B
0242: GOTO 245
0243: BTFSC 2F.7
0244: GOTO 254
0245: MOVF 2F,F
0246: BTFSS 03.2
0247: GOTO 24B
0248: SUBWF 2E,W
0249: BTFSS 03.0
024A: GOTO 254
024B: BSF 03.5
024C: BCF 05.1
024D: BCF 03.5
024E: BCF 05.1
024F: BSF 03.5
0250: BCF 05.0
0251: BCF 03.5
0252: BSF 05.0
0253: GOTO 25C
0254: BSF 03.5
0255: BCF 05.0
0256: BCF 03.5
0257: BCF 05.0
0258: BSF 03.5
0259: BCF 05.1
025A: BCF 03.5
025B: BCF 05.1
025C: MOVF 01,W
025D: BTFSS 00.7
025E: GOTO 262
025F: BTFSS 31.7
0260: GOTO 26A
0261: GOTO 264
0262: BTFSC 31.7
0263: GOTO 273
0264: MOVF 31,F
0265: BTFSS 03.2
0266: GOTO 26A
0267: SUBWF 30,W
0268: BTFSS 03.0
0269: GOTO 273
026A: BSF 03.5
026B: BCF 05.7
026C: BCF 03.5
026D: BCF 05.7
026E: BSF 03.5
026F: BCF 05.6
0270: BCF 03.5
0271: BSF 05.6
0272: GOTO 27B
0273: BSF 03.5
0274: BCF 05.6
0275: BCF 03.5
0276: BCF 05.6
0277: BSF 03.5
0278: BCF 05.7
0279: BCF 03.5
027A: BCF 05.7
....................
.................... delay_us(1500);
027B: CLRWDT
027C: MOVLW 01
027D: MOVWF 39
027E: CALL 065
027F: MOVLW 02
0280: MOVWF 35
0281: CLRF 29
0282: BTFSC 0B.7
0283: BSF 29.7
0284: BCF 0B.7
0285: MOVLW F7
0286: MOVWF 3C
0287: CALL 037
0288: BTFSC 29.7
0289: BSF 0B.7
028A: DECFSZ 35,F
028B: GOTO 281
....................
.................... output_low(STROBE);
028C: BSF 03.5
028D: BCF 06.0
028E: BCF 03.5
028F: BCF 06.0
.................... sensors = spi_read(0); // cteni senzoru
0290: MOVF 13,W
0291: CLRF 13
0292: BSF 03.5
0293: BTFSC 14.0
0294: GOTO 297
0295: BCF 03.5
0296: GOTO 292
0297: BCF 03.5
0298: MOVF 13,W
0299: MOVWF 2A
.................... sensors=~sensors;
029A: COMF 2A,F
.................... output_high(STROBE);
029B: BSF 03.5
029C: BCF 06.0
029D: BCF 03.5
029E: BSF 06.0
....................
.................... i=0; // havarijni kod
029F: CLRF 34
.................... for (n=0; n<=6; n++)
02A0: CLRF 33
02A1: CLRF 32
02A2: MOVF 33,F
02A3: BTFSS 03.2
02A4: GOTO 2B9
02A5: MOVF 32,W
02A6: SUBLW 06
02A7: BTFSS 03.0
02A8: GOTO 2B9
.................... {
.................... if(bit_test(sensors,n)) i++;
02A9: MOVF 2A,W
02AA: MOVWF 77
02AB: MOVF 32,W
02AC: MOVWF 78
02AD: BTFSC 03.2
02AE: GOTO 2B3
02AF: BCF 03.0
02B0: RRF 77,F
02B1: DECFSZ 78,F
02B2: GOTO 2AF
02B3: BTFSC 77.0
02B4: INCF 34,F
.................... }
02B5: INCF 32,F
02B6: BTFSC 03.2
02B7: INCF 33,F
02B8: GOTO 2A2
.................... if (i>3) While(true){STOPR; STOPL;}; // zastavi, kdyz je cerno pod vice nez tremi cidly
02B9: MOVF 34,W
02BA: SUBLW 03
02BB: BTFSC 03.0
02BC: GOTO 2CE
02BD: BSF 03.5
02BE: BCF 05.6
02BF: BCF 03.5
02C0: BCF 05.6
02C1: BSF 03.5
02C2: BCF 05.7
02C3: BCF 03.5
02C4: BCF 05.7
02C5: BSF 03.5
02C6: BCF 05.0
02C7: BCF 03.5
02C8: BCF 05.0
02C9: BSF 03.5
02CA: BCF 05.1
02CB: BCF 03.5
02CC: BCF 05.1
02CD: GOTO 2BD
....................
.................... if(bit_test(sensors,7)) // detekce dihly
02CE: BTFSS 2A.7
02CF: GOTO 2D1
.................... {
.................... objizdka();
02D0: GOTO 07D
.................... }
....................
.................... if(bit_test(sensors,3)) //...|...//
02D1: BTFSS 2A.3
02D2: GOTO 2E1
.................... {
.................... uhel=STRED;
02D3: MOVLW 80
02D4: MOVWF 2C
.................... Lmotor=SPEEDMAX;
02D5: CLRF 2F
02D6: MOVLW 8C
02D7: MOVWF 2E
.................... Rmotor=SPEEDMAX;
02D8: CLRF 31
02D9: MOVWF 30
.................... line=S;
02DA: MOVLW 02
02DB: MOVWF 2B
.................... if (rovinka<255) rovinka++;
02DC: INCFSZ 2D,W
02DD: GOTO 2DF
02DE: GOTO 2E0
02DF: INCF 2D,F
.................... continue;
02E0: GOTO 23D
.................... }
....................
.................... if(bit_test(sensors,0)) //|......// // z duvodu zkraceni doby reakce se cidla nevyhodnocuji poporade ale od krajnich k prostrednimu
02E1: BTFSS 2A.0
02E2: GOTO 2ED
.................... {
.................... uhel=STRED-BEAR3;
02E3: MOVLW 49
02E4: MOVWF 2C
.................... Lmotor=0;
02E5: CLRF 2F
02E6: CLRF 2E
.................... Rmotor=SPEEDMAX;
02E7: CLRF 31
02E8: MOVLW 8C
02E9: MOVWF 30
.................... line=L;
02EA: MOVLW 01
02EB: MOVWF 2B
.................... continue;
02EC: GOTO 23D
.................... }
....................
.................... if(bit_test(sensors,6)) //......|//
02ED: BTFSS 2A.6
02EE: GOTO 2F8
.................... {
.................... uhel=STRED+BEAR3;
02EF: MOVLW B7
02F0: MOVWF 2C
.................... Rmotor=0;
02F1: CLRF 31
02F2: CLRF 30
.................... Lmotor=SPEEDMAX;
02F3: CLRF 2F
02F4: MOVLW 8C
02F5: MOVWF 2E
.................... line=R;
02F6: CLRF 2B
.................... continue;
02F7: GOTO 23D
.................... }
....................
.................... if(bit_test(sensors,1)) //.|.....//
02F8: BTFSS 2A.1
02F9: GOTO 305
.................... {
.................... uhel=STRED-BEAR2;
02FA: MOVLW 5E
02FB: MOVWF 2C
.................... Lmotor=SPEEDMAX-50;
02FC: CLRF 2F
02FD: MOVLW 5A
02FE: MOVWF 2E
.................... Rmotor=SPEEDMAX;
02FF: CLRF 31
0300: MOVLW 8C
0301: MOVWF 30
.................... line=S;
0302: MOVLW 02
0303: MOVWF 2B
.................... continue;
0304: GOTO 23D
.................... }
....................
.................... if(bit_test(sensors,5)) //.....|.//
0305: BTFSS 2A.5
0306: GOTO 312
.................... {
.................... uhel=STRED+BEAR2;
0307: MOVLW A2
0308: MOVWF 2C
.................... Rmotor=SPEEDMAX-50;
0309: CLRF 31
030A: MOVLW 5A
030B: MOVWF 30
.................... Lmotor=SPEEDMAX;
030C: CLRF 2F
030D: MOVLW 8C
030E: MOVWF 2E
.................... line=S;
030F: MOVLW 02
0310: MOVWF 2B
.................... continue;
0311: GOTO 23D
.................... }
....................
.................... if (bit_test(sensors,2)) //..|....//
0312: BTFSS 2A.2
0313: GOTO 322
.................... {
.................... uhel=STRED-BEAR1;
0314: MOVLW 74
0315: MOVWF 2C
.................... Lmotor=SPEEDMAX;
0316: CLRF 2F
0317: MOVLW 8C
0318: MOVWF 2E
.................... Rmotor=SPEEDMAX;
0319: CLRF 31
031A: MOVWF 30
.................... line=S;
031B: MOVLW 02
031C: MOVWF 2B
.................... if (rovinka<255) rovinka++;
031D: INCFSZ 2D,W
031E: GOTO 320
031F: GOTO 321
0320: INCF 2D,F
.................... continue;
0321: GOTO 23D
.................... }
....................
.................... if (bit_test(sensors,4)) //....|..//
0322: BTFSS 2A.4
0323: GOTO 331
.................... {
.................... uhel=STRED+BEAR1;
0324: MOVLW 8C
0325: MOVWF 2C
.................... Rmotor=SPEEDMAX;
0326: CLRF 31
0327: MOVWF 30
.................... Lmotor=SPEEDMAX;
0328: CLRF 2F
0329: MOVWF 2E
.................... line=S;
032A: MOVLW 02
032B: MOVWF 2B
.................... if (rovinka<255) rovinka++;
032C: INCFSZ 2D,W
032D: GOTO 32F
032E: GOTO 330
032F: INCF 2D,F
.................... continue;
0330: GOTO 23D
.................... }
....................
.................... if ((L==line) || (R==line)) // Brzdeni pri vyjeti z trate
0331: DECFSZ 2B,W
0332: GOTO 334
0333: GOTO 337
0334: MOVF 2B,F
0335: BTFSS 03.2
0336: GOTO 34F
.................... {
.................... if (rovinka>250)
0337: MOVF 2D,W
0338: SUBLW FA
0339: BTFSC 03.0
033A: GOTO 34E
.................... {
.................... BL; BR;
033B: BSF 03.5
033C: BCF 05.0
033D: BCF 03.5
033E: BCF 05.0
033F: BSF 03.5
0340: BCF 05.1
0341: BCF 03.5
0342: BSF 05.1
0343: BSF 03.5
0344: BCF 05.6
0345: BCF 03.5
0346: BCF 05.6
0347: BSF 03.5
0348: BCF 05.7
0349: BCF 03.5
034A: BSF 05.7
.................... Delay_ms(100);
034B: MOVLW 64
034C: MOVWF 39
034D: CALL 065
.................... };
.................... rovinka=0;
034E: CLRF 2D
.................... };
....................
.................... }
034F: GOTO 23D
.................... }
0350: SLEEP
Configuration Fuses:
Word 1: 3F38 NOWDT NOPUT MCLR NOBROWNOUT NOLVP NOCPD NOWRT NODEBUG CCPB0 NOPROTECT INTRC_IO
Word 2: 3FFC NOFCMEN NOIESO