Blame | Last modification | View Log | Download
CCS PCM C Compiler, Version 3.245, 27853 22-IV-06 16:00
Filename: D:\KAKLIK\programy\PIC_C\roboti\istrobot\3Orbis\main.lst
ROM used: 666 words (16%)
Largest free fragment is 2048
RAM used: 32 (18%) at main() level
35 (20%) worst case
Stack: 3 worst case (1 in main + 2 for interrupts)
*
0000: MOVLW 00
0001: MOVWF 0A
0002: GOTO 089
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.0
001F: GOTO 022
0020: BTFSC 0C.0
0021: GOTO 03B
0022: MOVLW 8C
0023: MOVWF 04
0024: BTFSS 00.1
0025: GOTO 028
0026: BTFSC 0C.1
0027: GOTO 03D
0028: MOVF 22,W
0029: MOVWF 04
002A: MOVF 23,W
002B: MOVWF 77
002C: MOVF 24,W
002D: MOVWF 78
002E: MOVF 25,W
002F: MOVWF 79
0030: MOVF 26,W
0031: MOVWF 7A
0032: MOVF 27,W
0033: MOVWF 7B
0034: MOVF 28,W
0035: MOVWF 0A
0036: SWAPF 21,W
0037: MOVWF 03
0038: SWAPF 7F,F
0039: SWAPF 7F,W
003A: RETFIE
003B: BCF 0A.3
003C: GOTO 03F
003D: BCF 0A.3
003E: GOTO 053
.................... #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)
*
0043: MOVLW 08
0044: SUBWF 3D,F
0045: BTFSS 03.0
0046: GOTO 052
0047: MOVLW 3D
0048: MOVWF 04
0049: BCF 03.0
004A: RRF 00,F
004B: MOVF 00,W
004C: BTFSC 03.2
004D: GOTO 052
004E: GOTO 050
004F: CLRWDT
0050: DECFSZ 00,F
0051: GOTO 04F
0052: RETLW 00
*
0071: MOVLW 3A
0072: MOVWF 04
0073: MOVF 00,W
0074: BTFSC 03.2
0075: GOTO 088
0076: MOVLW 02
0077: MOVWF 78
0078: MOVLW BF
0079: MOVWF 77
007A: CLRWDT
007B: DECFSZ 77,F
007C: GOTO 07A
007D: DECFSZ 78,F
007E: GOTO 078
007F: MOVLW 96
0080: MOVWF 77
0081: DECFSZ 77,F
0082: GOTO 081
0083: NOP
0084: NOP
0085: CLRWDT
0086: DECFSZ 00,F
0087: GOTO 076
0088: 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 6//10 // 3 stupne zataceni
.................... #define BEAR2 10//27
.................... #define BEAR3 40
.................... #define SPEEDMAX 160 // ANSMANN=140; GP=120; maximalni rozumna rychlost
.................... #define R17 255 // X nasobek rozumne rychlosti
.................... #define DOZNIVANI 10
.................... #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
....................
.................... short int preteceni; // flag preteceni timeru1
....................
.................... 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_TIMER1
.................... TIMER1_isr()
.................... {
.................... preteceni = true;
*
003F: BSF 2F.0
.................... }
.................... ////////////////////////////////////////////////////////////////////////////////
0040: BCF 0C.0
0041: BCF 0A.3
0042: GOTO 028
.................... #int_TIMER2
.................... TIMER2_isr() // ovladani serva
.................... {
.................... unsigned int8 n;
....................
.................... output_high(SERVO);
*
0053: BSF 03.5
0054: BCF 05.2
0055: BCF 03.5
0056: BSF 05.2
.................... delay_us(1000);
0057: CLRWDT
0058: MOVLW 09
0059: MOVWF 3C
005A: MOVLW 6D
005B: MOVWF 3D
005C: CALL 043
005D: DECFSZ 3C,F
005E: GOTO 05A
.................... for(n=uhel; n>0; n--) Delay_us(2);
005F: MOVF 2C,W
0060: MOVWF 3B
0061: MOVF 3B,F
0062: BTFSC 03.2
0063: GOTO 06A
0064: CLRWDT
0065: NOP
0066: NOP
0067: NOP
0068: DECF 3B,F
0069: GOTO 061
.................... output_low(SERVO);
006A: BSF 03.5
006B: BCF 05.2
006C: BCF 03.5
006D: BCF 05.2
.................... }
....................
.................... ////////////////////////////////////////////////////////////////////////////////
006E: BCF 0C.1
006F: BCF 0A.3
0070: GOTO 028
.................... 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;
.................... unsigned int16 n;
....................
.................... BR;BL;
.................... Delay_ms(400);
.................... STOPR;STOPL;
....................
.................... uhel=KOLMO1; // nastav zataceci kolecko kolmo na osu robota
.................... Delay_ms(100);
.................... BL;FR;
.................... Delay_ms(200); // minimalni toceni, kdyby se zastavilo sikmo k cihle
....................
.................... While(bit_test(sensors,7)) // toc, dokud neni cihla z primeho senzoru
.................... {
.................... sensors = spi_read(0); // cteni senzoru
.................... sensors=~sensors;
.................... Delay_ms(4); // cekani na SLAVE nez pripravi data od cidel
.................... }
.................... STOPL; STOPR;
....................
.................... for (n=0;n<1500;n++) // vystred se na hranu cihly
.................... {
.................... if(!input(CIHLA)) {BL; FR;} else {FL; BR;};
.................... delay_ms(1);
.................... }
.................... STOPR;STOPL;
....................
.................... uhel=STRED; // dopredu
.................... delay_ms(100);
.................... FR; FL;
.................... delay_ms(500);
.................... BL;BR;
.................... delay_ms(200);
.................... STOPL;STOPR;
....................
.................... uhel=STRED+BEAR3; // doprava
.................... delay_ms(100);
.................... FL;
.................... delay_ms(200);
.................... uhel=STRED+BEAR2; // min doprava
.................... FL;FR;
.................... delay_ms(200);
.................... uhel=STRED+BEAR1; // jeste min doprava
.................... FL;FR;
.................... delay_ms(200);
.................... uhel=STRED; // rovne
.................... FL;FR;
.................... delay_ms(100);
.................... While((sensors & 0b01111111)!=0) //dokud neni cara
.................... {
.................... sensors = spi_read(0); // cteni senzoru
.................... sensors=~sensors;
.................... Delay_ms(4); // cekani na SLAVE nez pripravi data od cidel
.................... }
.................... BL; BR;
.................... delay_ms(400);
....................
.................... uhel=STRED-BEAR3; // doleva
.................... }
....................
.................... ////////////////////////////////////////////////////////////////////////////////
.................... void main()
.................... {
*
0089: CLRF 04
008A: MOVLW 1F
008B: ANDWF 03,F
008C: MOVLW 70
008D: BSF 03.5
008E: MOVWF 0F
008F: BCF 1F.4
0090: BCF 1F.5
0091: MOVF 1B,W
0092: ANDLW 80
0093: MOVWF 1B
0094: MOVLW 07
0095: MOVWF 1C
....................
.................... unsigned int8 n;
.................... unsigned int8 i,v;
.................... unsigned int8 last_sensors;
.................... unsigned int8 j=0;
0096: BCF 03.5
0097: CLRF 38
....................
.................... setup_adc_ports(NO_ANALOGS);
0098: BSF 03.5
0099: BCF 1F.4
009A: BCF 1F.5
009B: MOVF 1B,W
009C: ANDLW 80
009D: MOVWF 1B
.................... setup_adc(ADC_CLOCK_INTERNAL);
009E: BCF 1F.6
009F: BCF 03.5
00A0: BSF 1F.6
00A1: BSF 1F.7
00A2: BSF 03.5
00A3: BCF 1F.7
00A4: BCF 03.5
00A5: BSF 1F.0
.................... setup_spi(SPI_MASTER|SPI_H_TO_L|SPI_XMIT_L_TO_H|SPI_CLK_DIV_16);
00A6: BCF 14.5
00A7: BSF 03.5
00A8: BCF 06.2
00A9: BSF 06.1
00AA: BCF 06.4
00AB: MOVLW 31
00AC: BCF 03.5
00AD: MOVWF 14
00AE: MOVLW 00
00AF: BSF 03.5
00B0: MOVWF 14
.................... setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
00B1: MOVF 01,W
00B2: ANDLW C7
00B3: IORLW 08
00B4: MOVWF 01
.................... setup_timer_1(T1_INTERNAL|T1_DIV_BY_8);
00B5: MOVLW B5
00B6: BCF 03.5
00B7: MOVWF 10
.................... setup_timer_2(T2_DIV_BY_16,140,16);
00B8: MOVLW 78
00B9: MOVWF 78
00BA: IORLW 06
00BB: MOVWF 12
00BC: MOVLW 8C
00BD: BSF 03.5
00BE: MOVWF 12
.................... setup_oscillator(OSC_8MHZ|OSC_INTRC);
00BF: MOVLW 72
00C0: MOVWF 0F
....................
.................... STOPR; STOPL; // zastav motory
00C1: BCF 05.6
00C2: BCF 03.5
00C3: BCF 05.6
00C4: BSF 03.5
00C5: BCF 05.7
00C6: BCF 03.5
00C7: BCF 05.7
00C8: BSF 03.5
00C9: BCF 05.0
00CA: BCF 03.5
00CB: BCF 05.0
00CC: BSF 03.5
00CD: BCF 05.1
00CE: BCF 03.5
00CF: BCF 05.1
.................... Lmotor=0;Rmotor=0;
00D0: CLRF 31
00D1: CLRF 30
00D2: CLRF 33
00D3: CLRF 32
....................
.................... uhel = STRED; // nastav zadni kolecko na stred
00D4: MOVLW 80
00D5: MOVWF 2C
.................... rovinka = 0;
00D6: CLRF 2E
....................
.................... enable_interrupts(INT_TIMER2);
00D7: BSF 03.5
00D8: BSF 0C.1
.................... enable_interrupts(INT_TIMER1);
00D9: BSF 0C.0
.................... enable_interrupts(GLOBAL);
00DA: MOVLW C0
00DB: BCF 03.5
00DC: IORWF 0B,F
....................
.................... output_low(IRTX); // zapni IR vysilac
00DD: BSF 03.5
00DE: BCF 06.2
00DF: BCF 03.5
00E0: BCF 06.2
....................
.................... delay_ms(1000);
00E1: MOVLW 04
00E2: MOVWF 39
00E3: MOVLW FA
00E4: MOVWF 3A
00E5: CALL 071
00E6: DECFSZ 39,F
00E7: GOTO 0E3
....................
.................... //!!!!
.................... speed=SPEEDMAX;
00E8: MOVLW A0
00E9: MOVWF 2D
....................
.................... while(true)
.................... {
....................
.................... GO(L,F,Lmotor);GO(R,F,Rmotor); // zapni motory PWM podle promenych Lmotor a Rmotor
00EA: MOVF 01,W
00EB: BTFSS 00.7
00EC: GOTO 0F0
00ED: BTFSS 31.7
00EE: GOTO 0F8
00EF: GOTO 0F2
00F0: BTFSC 31.7
00F1: GOTO 101
00F2: MOVF 31,F
00F3: BTFSS 03.2
00F4: GOTO 0F8
00F5: SUBWF 30,W
00F6: BTFSS 03.0
00F7: GOTO 101
00F8: BSF 03.5
00F9: BCF 05.1
00FA: BCF 03.5
00FB: BCF 05.1
00FC: BSF 03.5
00FD: BCF 05.0
00FE: BCF 03.5
00FF: BSF 05.0
0100: GOTO 109
0101: BSF 03.5
0102: BCF 05.0
0103: BCF 03.5
0104: BCF 05.0
0105: BSF 03.5
0106: BCF 05.1
0107: BCF 03.5
0108: BCF 05.1
0109: MOVF 01,W
010A: BTFSS 00.7
010B: GOTO 10F
010C: BTFSS 33.7
010D: GOTO 117
010E: GOTO 111
010F: BTFSC 33.7
0110: GOTO 120
0111: MOVF 33,F
0112: BTFSS 03.2
0113: GOTO 117
0114: SUBWF 32,W
0115: BTFSS 03.0
0116: GOTO 120
0117: BSF 03.5
0118: BCF 05.7
0119: BCF 03.5
011A: BCF 05.7
011B: BSF 03.5
011C: BCF 05.6
011D: BCF 03.5
011E: BSF 05.6
011F: GOTO 128
0120: BSF 03.5
0121: BCF 05.6
0122: BCF 03.5
0123: BCF 05.6
0124: BSF 03.5
0125: BCF 05.7
0126: BCF 03.5
0127: BCF 05.7
....................
.................... delay_us(1500); // cekani na SLAVE, nez pripravi data od cidel
0128: CLRWDT
0129: MOVLW 01
012A: MOVWF 3A
012B: CALL 071
012C: MOVLW 02
012D: MOVWF 39
012E: CLRF 29
012F: BTFSC 0B.7
0130: BSF 29.7
0131: BCF 0B.7
0132: MOVLW F7
0133: MOVWF 3D
0134: CALL 043
0135: BTFSC 29.7
0136: BSF 0B.7
0137: DECFSZ 39,F
0138: GOTO 12E
....................
.................... last_sensors = sensors;
0139: MOVF 2A,W
013A: MOVWF 37
.................... j++;
013B: INCF 38,F
....................
.................... output_low(STROBE); // vypni zobrazovani na posuvnem registru
013C: BSF 03.5
013D: BCF 06.0
013E: BCF 03.5
013F: BCF 06.0
.................... sensors = spi_read(0); // cteni senzoru
0140: MOVF 13,W
0141: CLRF 13
0142: BSF 03.5
0143: BTFSC 14.0
0144: GOTO 147
0145: BCF 03.5
0146: GOTO 142
0147: BCF 03.5
0148: MOVF 13,W
0149: MOVWF 2A
.................... sensors=~sensors;
014A: COMF 2A,F
.................... output_high(STROBE); // zobraz data na posuvnem registru
014B: BSF 03.5
014C: BCF 06.0
014D: BCF 03.5
014E: BSF 06.0
....................
....................
....................
....................
.................... if(false == preteceni)
014F: MOVLW 00
0150: BTFSC 2F.0
0151: MOVLW 01
0152: XORLW 00
0153: BTFSS 03.2
0154: GOTO 16B
.................... {
.................... v = 255 - (get_timer1() >> 8);
0155: MOVF 0F,W
0156: MOVWF 7A
0157: MOVF 0E,W
0158: MOVWF 77
0159: MOVF 0F,W
015A: SUBWF 7A,W
015B: BTFSS 03.2
015C: GOTO 155
015D: MOVF 77,W
015E: MOVWF 39
015F: MOVF 7A,W
0160: MOVWF 3A
0161: MOVF 3A,W
0162: CLRF 7A
0163: SUBLW FF
0164: MOVWF 36
.................... v >>= 3;
0165: RRF 36,F
0166: RRF 36,F
0167: RRF 36,F
0168: MOVLW 1F
0169: ANDWF 36,F
.................... }
.................... else
016A: GOTO 16D
.................... {
.................... v=0;
016B: CLRF 36
.................... preteceni=false;
016C: BCF 2F.0
.................... }
....................
....................
....................
.................... i=0; // havarijni kod
016D: CLRF 35
.................... for (n=0; n<=6; n++)
016E: CLRF 34
016F: MOVF 34,W
0170: SUBLW 06
0171: BTFSS 03.0
0172: GOTO 181
.................... {
.................... if(bit_test(sensors,n)) i++;
0173: MOVF 2A,W
0174: MOVWF 77
0175: MOVF 34,W
0176: MOVWF 78
0177: BTFSC 03.2
0178: GOTO 17D
0179: BCF 03.0
017A: RRF 77,F
017B: DECFSZ 78,F
017C: GOTO 179
017D: BTFSC 77.0
017E: INCF 35,F
.................... }
017F: INCF 34,F
0180: GOTO 16F
.................... if (i>3) While(true){STOPR; STOPL;}; // zastavi, kdyz je cerno pod vice nez tremi cidly
0181: MOVF 35,W
0182: SUBLW 03
0183: BTFSC 03.0
0184: GOTO 196
0185: BSF 03.5
0186: BCF 05.6
0187: BCF 03.5
0188: BCF 05.6
0189: BSF 03.5
018A: BCF 05.7
018B: BCF 03.5
018C: BCF 05.7
018D: BSF 03.5
018E: BCF 05.0
018F: BCF 03.5
0190: BCF 05.0
0191: BSF 03.5
0192: BCF 05.1
0193: BCF 03.5
0194: BCF 05.1
0195: GOTO 185
....................
....................
....................
.................... if(bit_test(sensors,7)) // detekce cihly
0196: BTFSS 2A.7
0197: GOTO 198
.................... {
.................... //!!! objizdka(); // objede cihlu
.................... }
....................
....................
....................
.................... if(bit_test(sensors,3)) //...|...//
0198: BTFSS 2A.3
0199: GOTO 1AF
.................... {
.................... uhel=STRED;
019A: MOVLW 80
019B: MOVWF 2C
.................... Lmotor=speed;
019C: CLRF 7A
019D: MOVF 2D,W
019E: MOVWF 30
019F: MOVF 7A,W
01A0: MOVWF 31
.................... Rmotor=speed;
01A1: CLRF 7A
01A2: MOVF 2D,W
01A3: MOVWF 32
01A4: MOVF 7A,W
01A5: MOVWF 33
.................... line=S;
01A6: MOVLW 02
01A7: MOVWF 2B
.................... set_timer1(0);
01A8: CLRF 0F
01A9: CLRF 0E
.................... if (rovinka < 255) rovinka++;
01AA: INCFSZ 2E,W
01AB: GOTO 1AD
01AC: GOTO 1AE
01AD: INCF 2E,F
.................... // if (speed > SPEEDMAX) speed--;
.................... continue;
01AE: GOTO 0EA
.................... }
....................
.................... if(bit_test(sensors,0)) //|......// // z duvodu zkraceni doby reakce se cidla nevyhodnocuji poporade ale od krajnich k prostrednimu
01AF: BTFSS 2A.0
01B0: GOTO 1CD
.................... {
.................... if(sensors != last_sensors) uhel=STRED - BEAR3 - v;
01B1: MOVF 37,W
01B2: SUBWF 2A,W
01B3: BTFSC 03.2
01B4: GOTO 1B8
01B5: MOVF 36,W
01B6: SUBLW 58
01B7: MOVWF 2C
.................... if(j>=DOZNIVANI)
01B8: MOVF 38,W
01B9: SUBLW 09
01BA: BTFSC 03.0
01BB: GOTO 1C1
.................... {
.................... j=0;
01BC: CLRF 38
.................... if(uhel<STRED - BEAR3) uhel++;
01BD: MOVF 2C,W
01BE: SUBLW 57
01BF: BTFSC 03.0
01C0: INCF 2C,F
.................... }
.................... Lmotor=0;
01C1: CLRF 31
01C2: CLRF 30
.................... Rmotor=speed;
01C3: CLRF 7A
01C4: MOVF 2D,W
01C5: MOVWF 32
01C6: MOVF 7A,W
01C7: MOVWF 33
.................... line=L;
01C8: MOVLW 01
01C9: MOVWF 2B
.................... set_timer1(0);
01CA: CLRF 0F
01CB: CLRF 0E
.................... // if (speed > SPEEDMAX) speed--;
.................... continue;
01CC: GOTO 0EA
.................... }
....................
.................... if(bit_test(sensors,6)) //......|//
01CD: BTFSS 2A.6
01CE: GOTO 1EA
.................... {
.................... if(sensors != last_sensors) uhel=STRED + BEAR3 + v;
01CF: MOVF 37,W
01D0: SUBWF 2A,W
01D1: BTFSC 03.2
01D2: GOTO 1D6
01D3: MOVLW A8
01D4: ADDWF 36,W
01D5: MOVWF 2C
.................... if(j>=DOZNIVANI)
01D6: MOVF 38,W
01D7: SUBLW 09
01D8: BTFSC 03.0
01D9: GOTO 1DF
.................... {
.................... j=0;
01DA: CLRF 38
.................... if(uhel>STRED + BEAR3) uhel--;
01DB: MOVF 2C,W
01DC: SUBLW A8
01DD: BTFSS 03.0
01DE: DECF 2C,F
.................... }
.................... Rmotor=0;
01DF: CLRF 33
01E0: CLRF 32
.................... Lmotor=speed;
01E1: CLRF 7A
01E2: MOVF 2D,W
01E3: MOVWF 30
01E4: MOVF 7A,W
01E5: MOVWF 31
.................... line=R;
01E6: CLRF 2B
.................... set_timer1(0);
01E7: CLRF 0F
01E8: CLRF 0E
.................... // if (speed > SPEEDMAX) speed--;
.................... continue;
01E9: GOTO 0EA
.................... }
....................
.................... if(bit_test(sensors,1)) //.|.....//
01EA: BTFSS 2A.1
01EB: GOTO 20C
.................... {
.................... if(sensors != last_sensors) uhel=STRED - BEAR2 - v;
01EC: MOVF 37,W
01ED: SUBWF 2A,W
01EE: BTFSC 03.2
01EF: GOTO 1F3
01F0: MOVF 36,W
01F1: SUBLW 76
01F2: MOVWF 2C
.................... if(j>=DOZNIVANI)
01F3: MOVF 38,W
01F4: SUBLW 09
01F5: BTFSC 03.0
01F6: GOTO 1FC
.................... {
.................... j=0;
01F7: CLRF 38
.................... if(uhel<STRED - BEAR2) uhel++;
01F8: MOVF 2C,W
01F9: SUBLW 75
01FA: BTFSC 03.0
01FB: INCF 2C,F
.................... }
.................... Lmotor=speed-50;
01FC: MOVLW 32
01FD: SUBWF 2D,W
01FE: CLRF 7A
01FF: MOVWF 30
0200: MOVF 7A,W
0201: MOVWF 31
.................... Rmotor=speed;
0202: CLRF 7A
0203: MOVF 2D,W
0204: MOVWF 32
0205: MOVF 7A,W
0206: MOVWF 33
.................... line=S;
0207: MOVLW 02
0208: MOVWF 2B
.................... set_timer1(0);
0209: CLRF 0F
020A: CLRF 0E
.................... // if (speed > SPEEDMAX) speed--;
.................... continue;
020B: GOTO 0EA
.................... }
....................
.................... if(bit_test(sensors,5)) //.....|.//
020C: BTFSS 2A.5
020D: GOTO 22E
.................... {
.................... if(sensors != last_sensors) uhel=STRED + BEAR2 + v;
020E: MOVF 37,W
020F: SUBWF 2A,W
0210: BTFSC 03.2
0211: GOTO 215
0212: MOVLW 8A
0213: ADDWF 36,W
0214: MOVWF 2C
.................... if(j>=DOZNIVANI)
0215: MOVF 38,W
0216: SUBLW 09
0217: BTFSC 03.0
0218: GOTO 21E
.................... {
.................... j=0;
0219: CLRF 38
.................... if(uhel>STRED + BEAR2) uhel--;
021A: MOVF 2C,W
021B: SUBLW 8A
021C: BTFSS 03.0
021D: DECF 2C,F
.................... }
.................... Rmotor=speed-50;
021E: MOVLW 32
021F: SUBWF 2D,W
0220: CLRF 7A
0221: MOVWF 32
0222: MOVF 7A,W
0223: MOVWF 33
.................... Lmotor=speed;
0224: CLRF 7A
0225: MOVF 2D,W
0226: MOVWF 30
0227: MOVF 7A,W
0228: MOVWF 31
.................... line=S;
0229: MOVLW 02
022A: MOVWF 2B
.................... set_timer1(0);
022B: CLRF 0F
022C: CLRF 0E
.................... // if (speed > SPEEDMAX) speed--;
.................... continue;
022D: GOTO 0EA
.................... }
....................
.................... if (bit_test(sensors,2)) //..|....//
022E: BTFSS 2A.2
022F: GOTO 253
.................... {
.................... if(sensors != last_sensors) uhel=STRED - BEAR1 - v;
0230: MOVF 37,W
0231: SUBWF 2A,W
0232: BTFSC 03.2
0233: GOTO 237
0234: MOVF 36,W
0235: SUBLW 7A
0236: MOVWF 2C
.................... if(j>=DOZNIVANI)
0237: MOVF 38,W
0238: SUBLW 09
0239: BTFSC 03.0
023A: GOTO 240
.................... {
.................... if(uhel<STRED - BEAR1)uhel++;
023B: MOVF 2C,W
023C: SUBLW 79
023D: BTFSC 03.0
023E: INCF 2C,F
.................... j=0;
023F: CLRF 38
.................... }
.................... Lmotor=speed;
0240: CLRF 7A
0241: MOVF 2D,W
0242: MOVWF 30
0243: MOVF 7A,W
0244: MOVWF 31
.................... Rmotor=speed;
0245: CLRF 7A
0246: MOVF 2D,W
0247: MOVWF 32
0248: MOVF 7A,W
0249: MOVWF 33
.................... line=S;
024A: MOVLW 02
024B: MOVWF 2B
.................... set_timer1(0);
024C: CLRF 0F
024D: CLRF 0E
.................... if (rovinka<255) rovinka++;
024E: INCFSZ 2E,W
024F: GOTO 251
0250: GOTO 252
0251: INCF 2E,F
.................... // if (speed > SPEEDMAX) speed--;
.................... continue;
0252: GOTO 0EA
.................... }
....................
.................... if (bit_test(sensors,4)) //....|..//
0253: BTFSS 2A.4
0254: GOTO 278
.................... {
.................... if(sensors != last_sensors) uhel=STRED + BEAR1 + v;
0255: MOVF 37,W
0256: SUBWF 2A,W
0257: BTFSC 03.2
0258: GOTO 25C
0259: MOVLW 86
025A: ADDWF 36,W
025B: MOVWF 2C
.................... if(j>=DOZNIVANI)
025C: MOVF 38,W
025D: SUBLW 09
025E: BTFSC 03.0
025F: GOTO 265
.................... {
.................... j=0;
0260: CLRF 38
.................... if(uhel>STRED + BEAR1) uhel--;
0261: MOVF 2C,W
0262: SUBLW 86
0263: BTFSS 03.0
0264: DECF 2C,F
.................... }
.................... Rmotor=speed;
0265: CLRF 7A
0266: MOVF 2D,W
0267: MOVWF 32
0268: MOVF 7A,W
0269: MOVWF 33
.................... Lmotor=speed;
026A: CLRF 7A
026B: MOVF 2D,W
026C: MOVWF 30
026D: MOVF 7A,W
026E: MOVWF 31
.................... line=S;
026F: MOVLW 02
0270: MOVWF 2B
.................... set_timer1(0);
0271: CLRF 0F
0272: CLRF 0E
.................... if (rovinka<255) rovinka++;
0273: INCFSZ 2E,W
0274: GOTO 276
0275: GOTO 277
0276: INCF 2E,F
.................... // if (speed > SPEEDMAX) speed--;
.................... continue;
0277: GOTO 0EA
.................... }
....................
.................... if ((L==line) || (R==line)) // Brzdeni pri vyjeti z trate
0278: DECFSZ 2B,W
0279: GOTO 27B
027A: GOTO 27E
027B: MOVF 2B,F
027C: BTFSS 03.2
027D: GOTO 298
.................... {
.................... if (rovinka>250)
027E: MOVF 2E,W
027F: SUBLW FA
0280: BTFSC 03.0
0281: GOTO 295
.................... {
.................... BL; BR;
0282: BSF 03.5
0283: BCF 05.0
0284: BCF 03.5
0285: BCF 05.0
0286: BSF 03.5
0287: BCF 05.1
0288: BCF 03.5
0289: BSF 05.1
028A: BSF 03.5
028B: BCF 05.6
028C: BCF 03.5
028D: BCF 05.6
028E: BSF 03.5
028F: BCF 05.7
0290: BCF 03.5
0291: BSF 05.7
.................... Delay_ms(100);
0292: MOVLW 64
0293: MOVWF 3A
0294: CALL 071
.................... };
.................... rovinka=0;
0295: CLRF 2E
.................... speed=SPEEDMAX;
0296: MOVLW A0
0297: MOVWF 2D
.................... };
.................... }
0298: GOTO 0EA
.................... }
0299: SLEEP
Configuration Fuses:
Word 1: 3F38 NOWDT NOPUT MCLR NOBROWNOUT NOLVP NOCPD NOWRT NODEBUG CCPB0 NOPROTECT INTRC_IO
Word 2: 3FFC NOFCMEN NOIESO