Subversion Repositories svnkaklik

Rev

Go to most recent revision | Blame | Last modification | View Log | Download

CCS PCM C Compiler, Version 3.245, 27853               22-IV-06 23:50

               Filename: D:\KAKLIK\programy\PIC_C\roboti\istrobot\3Orbis\main.lst

               ROM used: 960 words (23%)
                         Largest free fragment is 2048
               RAM used: 30 (17%) at main() level
                         37 (21%) worst case
               Stack:    4 worst case (2 in main + 2 for interrupts)

*
0000:  MOVLW  00
0001:  MOVWF  0A
0002:  GOTO   212
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  3F,F
0045:  BTFSS  03.0
0046:  GOTO   052
0047:  MOVLW  3F
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  3C
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       10//10           // 3 stupne zataceni 
.................... #define  BEAR2       25//27 
.................... #define  BEAR3       45 
.................... #define  SPEEDMAX    140         // ANSMANN=140; GP=120; maximalni rozumna rychlost 
.................... #define  R17         255         // X nasobek rozumne rychlosti 
.................... #define  DOZNIVANI   10 
.................... #define  L1            1     // cara vlevo 
.................... #define  L2            2     // cara vlevo 
.................... #define  L3            3     // cara vlevo 
.................... #define  S             0     // casa mezi sensory 
.................... #define  R1           -1     // cara vpravo 
.................... #define  R2           -2     // cara vpravo 
.................... #define  R3           -3     // 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 
.................... signed int8 line = S;           // na ktere strane byla detekovana cara 
*
021F:  BCF    03.5
0220:  CLRF   2B
.................... //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  3E
005A:  MOVLW  6D
005B:  MOVWF  3F
005C:  CALL   043
005D:  DECFSZ 3E,F
005E:  GOTO   05A
....................    for(n=uhel; n>0; n--) Delay_us(2); 
005F:  MOVF   2C,W
0060:  MOVWF  3D
0061:  MOVF   3D,F
0062:  BTFSC  03.2
0063:  GOTO   06A
0064:  CLRWDT
0065:  NOP
0066:  NOP
0067:  NOP
0068:  DECF   3D,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; 
*
0089:  CLRF   38
....................    unsigned int16 n; 
....................  
....................    BR;BL; 
008A:  BSF    03.5
008B:  BCF    05.6
008C:  BCF    03.5
008D:  BCF    05.6
008E:  BSF    03.5
008F:  BCF    05.7
0090:  BCF    03.5
0091:  BSF    05.7
0092:  BSF    03.5
0093:  BCF    05.0
0094:  BCF    03.5
0095:  BCF    05.0
0096:  BSF    03.5
0097:  BCF    05.1
0098:  BCF    03.5
0099:  BSF    05.1
....................    Delay_ms(400); 
009A:  MOVLW  02
009B:  MOVWF  3B
009C:  MOVLW  C8
009D:  MOVWF  3C
009E:  CALL   071
009F:  DECFSZ 3B,F
00A0:  GOTO   09C
....................    STOPR;STOPL; 
00A1:  BSF    03.5
00A2:  BCF    05.6
00A3:  BCF    03.5
00A4:  BCF    05.6
00A5:  BSF    03.5
00A6:  BCF    05.7
00A7:  BCF    03.5
00A8:  BCF    05.7
00A9:  BSF    03.5
00AA:  BCF    05.0
00AB:  BCF    03.5
00AC:  BCF    05.0
00AD:  BSF    03.5
00AE:  BCF    05.1
00AF:  BCF    03.5
00B0:  BCF    05.1
....................  
.................... // toceni na miste dokud nezmizi cihla 
.................... //------------------------------------ 
....................    uhel=KOLMO1;      // nastav zataceci kolecko kolmo na osu robota 
00B1:  MOVLW  E1
00B2:  MOVWF  2C
....................    Delay_ms(100); 
00B3:  MOVLW  64
00B4:  MOVWF  3C
00B5:  CALL   071
....................    BL;FR; 
00B6:  BSF    03.5
00B7:  BCF    05.0
00B8:  BCF    03.5
00B9:  BCF    05.0
00BA:  BSF    03.5
00BB:  BCF    05.1
00BC:  BCF    03.5
00BD:  BSF    05.1
00BE:  BSF    03.5
00BF:  BCF    05.7
00C0:  BCF    03.5
00C1:  BCF    05.7
00C2:  BSF    03.5
00C3:  BCF    05.6
00C4:  BCF    03.5
00C5:  BSF    05.6
....................    Delay_ms(200);    // minimalni toceni, kdyby se zastavilo sikmo k cihle 
00C6:  MOVLW  C8
00C7:  MOVWF  3C
00C8:  CALL   071
....................  
....................    While(bit_test(sensors,7)) // toc, dokud neni cihla z primeho senzoru 
....................    { 
00C9:  BTFSS  2A.7
00CA:  GOTO   0DA
....................        sensors = spi_read(0);         // cteni senzoru 
00CB:  MOVF   13,W
00CC:  CLRF   13
00CD:  BSF    03.5
00CE:  BTFSC  14.0
00CF:  GOTO   0D2
00D0:  BCF    03.5
00D1:  GOTO   0CD
00D2:  BCF    03.5
00D3:  MOVF   13,W
00D4:  MOVWF  2A
....................        sensors=~sensors; 
00D5:  COMF   2A,F
....................        Delay_ms(4);              // cekani na SLAVE nez pripravi data od cidel 
00D6:  MOVLW  04
00D7:  MOVWF  3C
00D8:  CALL   071
....................    } 
00D9:  GOTO   0C9
....................    STOPL; STOPR; 
00DA:  BSF    03.5
00DB:  BCF    05.0
00DC:  BCF    03.5
00DD:  BCF    05.0
00DE:  BSF    03.5
00DF:  BCF    05.1
00E0:  BCF    03.5
00E1:  BCF    05.1
00E2:  BSF    03.5
00E3:  BCF    05.6
00E4:  BCF    03.5
00E5:  BCF    05.6
00E6:  BSF    03.5
00E7:  BCF    05.7
00E8:  BCF    03.5
00E9:  BCF    05.7
....................  
....................    for (n=0;n<1000;n++)    // vystred se na hranu cihly 
00EA:  CLRF   3A
00EB:  CLRF   39
00EC:  MOVF   3A,W
00ED:  SUBLW  03
00EE:  BTFSS  03.0
00EF:  GOTO   157
00F0:  BTFSS  03.2
00F1:  GOTO   0F6
00F2:  MOVF   39,W
00F3:  SUBLW  E7
00F4:  BTFSS  03.0
00F5:  GOTO   157
....................    { 
....................       if(!input(CIHLA)) 
00F6:  BSF    03.5
00F7:  BSF    05.3
00F8:  BCF    03.5
00F9:  BTFSC  05.3
00FA:  GOTO   126
....................       { 
.................... //      BL; FR; 
....................          GO(L,B,180);GO(R,F,160);   // zapni motory PWM podle promenych Lmotor a Rmotor 
00FB:  MOVF   01,W
00FC:  SUBLW  B4
00FD:  BTFSS  03.0
00FE:  GOTO   108
00FF:  BSF    03.5
0100:  BCF    05.0
0101:  BCF    03.5
0102:  BCF    05.0
0103:  BSF    03.5
0104:  BCF    05.1
0105:  BCF    03.5
0106:  BSF    05.1
0107:  GOTO   110
0108:  BSF    03.5
0109:  BCF    05.0
010A:  BCF    03.5
010B:  BCF    05.0
010C:  BSF    03.5
010D:  BCF    05.1
010E:  BCF    03.5
010F:  BCF    05.1
0110:  MOVF   01,W
0111:  SUBLW  A0
0112:  BTFSS  03.0
0113:  GOTO   11D
0114:  BSF    03.5
0115:  BCF    05.7
0116:  BCF    03.5
0117:  BCF    05.7
0118:  BSF    03.5
0119:  BCF    05.6
011A:  BCF    03.5
011B:  BSF    05.6
011C:  GOTO   125
011D:  BSF    03.5
011E:  BCF    05.6
011F:  BCF    03.5
0120:  BCF    05.6
0121:  BSF    03.5
0122:  BCF    05.7
0123:  BCF    03.5
0124:  BCF    05.7
....................       } else 
0125:  GOTO   150
....................       { 
.................... //      FL; BR; 
....................          GO(L,F,180);GO(R,B,160);   // zapni motory PWM podle promenych Lmotor a Rmotor 
0126:  MOVF   01,W
0127:  SUBLW  B4
0128:  BTFSS  03.0
0129:  GOTO   133
012A:  BSF    03.5
012B:  BCF    05.1
012C:  BCF    03.5
012D:  BCF    05.1
012E:  BSF    03.5
012F:  BCF    05.0
0130:  BCF    03.5
0131:  BSF    05.0
0132:  GOTO   13B
0133:  BSF    03.5
0134:  BCF    05.0
0135:  BCF    03.5
0136:  BCF    05.0
0137:  BSF    03.5
0138:  BCF    05.1
0139:  BCF    03.5
013A:  BCF    05.1
013B:  MOVF   01,W
013C:  SUBLW  A0
013D:  BTFSS  03.0
013E:  GOTO   148
013F:  BSF    03.5
0140:  BCF    05.6
0141:  BCF    03.5
0142:  BCF    05.6
0143:  BSF    03.5
0144:  BCF    05.7
0145:  BCF    03.5
0146:  BSF    05.7
0147:  GOTO   150
0148:  BSF    03.5
0149:  BCF    05.6
014A:  BCF    03.5
014B:  BCF    05.6
014C:  BSF    03.5
014D:  BCF    05.7
014E:  BCF    03.5
014F:  BCF    05.7
....................       }; 
....................       delay_ms(1); 
0150:  MOVLW  01
0151:  MOVWF  3C
0152:  CALL   071
....................    } 
0153:  INCF   39,F
0154:  BTFSC  03.2
0155:  INCF   3A,F
0156:  GOTO   0EC
....................    STOPR;STOPL; 
0157:  BSF    03.5
0158:  BCF    05.6
0159:  BCF    03.5
015A:  BCF    05.6
015B:  BSF    03.5
015C:  BCF    05.7
015D:  BCF    03.5
015E:  BCF    05.7
015F:  BSF    03.5
0160:  BCF    05.0
0161:  BCF    03.5
0162:  BCF    05.0
0163:  BSF    03.5
0164:  BCF    05.1
0165:  BCF    03.5
0166:  BCF    05.1
....................  
....................    uhel=STRED;          // dopredu 
0167:  MOVLW  80
0168:  MOVWF  2C
....................    delay_ms(100); 
0169:  MOVLW  64
016A:  MOVWF  3C
016B:  CALL   071
....................    FR; FL; 
016C:  BSF    03.5
016D:  BCF    05.7
016E:  BCF    03.5
016F:  BCF    05.7
0170:  BSF    03.5
0171:  BCF    05.6
0172:  BCF    03.5
0173:  BSF    05.6
0174:  BSF    03.5
0175:  BCF    05.1
0176:  BCF    03.5
0177:  BCF    05.1
0178:  BSF    03.5
0179:  BCF    05.0
017A:  BCF    03.5
017B:  BSF    05.0
....................    delay_ms(500); 
017C:  MOVLW  02
017D:  MOVWF  3B
017E:  MOVLW  FA
017F:  MOVWF  3C
0180:  CALL   071
0181:  DECFSZ 3B,F
0182:  GOTO   17E
....................    BL;BR; 
0183:  BSF    03.5
0184:  BCF    05.0
0185:  BCF    03.5
0186:  BCF    05.0
0187:  BSF    03.5
0188:  BCF    05.1
0189:  BCF    03.5
018A:  BSF    05.1
018B:  BSF    03.5
018C:  BCF    05.6
018D:  BCF    03.5
018E:  BCF    05.6
018F:  BSF    03.5
0190:  BCF    05.7
0191:  BCF    03.5
0192:  BSF    05.7
....................    delay_ms(200); 
0193:  MOVLW  C8
0194:  MOVWF  3C
0195:  CALL   071
....................    STOPL;STOPR; 
0196:  BSF    03.5
0197:  BCF    05.0
0198:  BCF    03.5
0199:  BCF    05.0
019A:  BSF    03.5
019B:  BCF    05.1
019C:  BCF    03.5
019D:  BCF    05.1
019E:  BSF    03.5
019F:  BCF    05.6
01A0:  BCF    03.5
01A1:  BCF    05.6
01A2:  BSF    03.5
01A3:  BCF    05.7
01A4:  BCF    03.5
01A5:  BCF    05.7
....................  
....................    uhel=STRED+BEAR3;    // doprava 
01A6:  MOVLW  AD
01A7:  MOVWF  2C
....................    delay_ms(100); 
01A8:  MOVLW  64
01A9:  MOVWF  3C
01AA:  CALL   071
....................    FL; 
01AB:  BSF    03.5
01AC:  BCF    05.1
01AD:  BCF    03.5
01AE:  BCF    05.1
01AF:  BSF    03.5
01B0:  BCF    05.0
01B1:  BCF    03.5
01B2:  BSF    05.0
....................    delay_ms(400); 
01B3:  MOVLW  02
01B4:  MOVWF  3B
01B5:  MOVLW  C8
01B6:  MOVWF  3C
01B7:  CALL   071
01B8:  DECFSZ 3B,F
01B9:  GOTO   1B5
....................    uhel=STRED+BEAR2;    // min doprava 
01BA:  MOVLW  99
01BB:  MOVWF  2C
....................    FL;FR; 
01BC:  BSF    03.5
01BD:  BCF    05.1
01BE:  BCF    03.5
01BF:  BCF    05.1
01C0:  BSF    03.5
01C1:  BCF    05.0
01C2:  BCF    03.5
01C3:  BSF    05.0
01C4:  BSF    03.5
01C5:  BCF    05.7
01C6:  BCF    03.5
01C7:  BCF    05.7
01C8:  BSF    03.5
01C9:  BCF    05.6
01CA:  BCF    03.5
01CB:  BSF    05.6
....................    delay_ms(100); 
01CC:  MOVLW  64
01CD:  MOVWF  3C
01CE:  CALL   071
....................    uhel=STRED+BEAR1;    // jeste min doprava 
01CF:  MOVLW  8A
01D0:  MOVWF  2C
....................    FL;FR; 
01D1:  BSF    03.5
01D2:  BCF    05.1
01D3:  BCF    03.5
01D4:  BCF    05.1
01D5:  BSF    03.5
01D6:  BCF    05.0
01D7:  BCF    03.5
01D8:  BSF    05.0
01D9:  BSF    03.5
01DA:  BCF    05.7
01DB:  BCF    03.5
01DC:  BCF    05.7
01DD:  BSF    03.5
01DE:  BCF    05.6
01DF:  BCF    03.5
01E0:  BSF    05.6
....................    delay_ms(200); 
01E1:  MOVLW  C8
01E2:  MOVWF  3C
01E3:  CALL   071
.................... /* 
....................    uhel=STRED;          // rovne 
....................    delay_ms(100); 
....................    FL;FR; 
....................    delay_ms(100); 
.................... */ 
....................    While((sensors & 0b01111111)!=0) //dokud neni cara 
....................    { 
01E4:  MOVF   2A,W
01E5:  ANDLW  7F
01E6:  BTFSC  03.2
01E7:  GOTO   1F7
....................        sensors = spi_read(0);         // cteni senzoru 
01E8:  MOVF   13,W
01E9:  CLRF   13
01EA:  BSF    03.5
01EB:  BTFSC  14.0
01EC:  GOTO   1EF
01ED:  BCF    03.5
01EE:  GOTO   1EA
01EF:  BCF    03.5
01F0:  MOVF   13,W
01F1:  MOVWF  2A
....................        sensors=~sensors; 
01F2:  COMF   2A,F
....................        Delay_ms(4);              // cekani na SLAVE nez pripravi data od cidel 
01F3:  MOVLW  04
01F4:  MOVWF  3C
01F5:  CALL   071
....................    } 
01F6:  GOTO   1E4
....................    BL; BR; 
01F7:  BSF    03.5
01F8:  BCF    05.0
01F9:  BCF    03.5
01FA:  BCF    05.0
01FB:  BSF    03.5
01FC:  BCF    05.1
01FD:  BCF    03.5
01FE:  BSF    05.1
01FF:  BSF    03.5
0200:  BCF    05.6
0201:  BCF    03.5
0202:  BCF    05.6
0203:  BSF    03.5
0204:  BCF    05.7
0205:  BCF    03.5
0206:  BSF    05.7
....................    delay_ms(400); 
0207:  MOVLW  02
0208:  MOVWF  3B
0209:  MOVLW  C8
020A:  MOVWF  3C
020B:  CALL   071
020C:  DECFSZ 3B,F
020D:  GOTO   209
....................  
....................    uhel=STRED-BEAR3;    // doleva 
020E:  MOVLW  53
020F:  MOVWF  2C
.................... } 
0210:  BCF    0A.3
0211:  GOTO   317 (RETURN)
....................  
.................... //////////////////////////////////////////////////////////////////////////////// 
.................... void main() 
.................... { 
0212:  CLRF   04
0213:  MOVLW  1F
0214:  ANDWF  03,F
0215:  MOVLW  70
0216:  BSF    03.5
0217:  MOVWF  0F
0218:  BCF    1F.4
0219:  BCF    1F.5
021A:  MOVF   1B,W
021B:  ANDLW  80
021C:  MOVWF  1B
021D:  MOVLW  07
021E:  MOVWF  1C
....................  
....................    unsigned int8 n; 
....................    unsigned int8 i,v; 
....................    unsigned int8 last_sensors; 
....................  
....................    setup_adc_ports(NO_ANALOGS); 
*
0221:  BSF    03.5
0222:  BCF    1F.4
0223:  BCF    1F.5
0224:  MOVF   1B,W
0225:  ANDLW  80
0226:  MOVWF  1B
....................    setup_adc(ADC_CLOCK_INTERNAL); 
0227:  BCF    1F.6
0228:  BCF    03.5
0229:  BSF    1F.6
022A:  BSF    1F.7
022B:  BSF    03.5
022C:  BCF    1F.7
022D:  BCF    03.5
022E:  BSF    1F.0
....................    setup_spi(SPI_MASTER|SPI_H_TO_L|SPI_XMIT_L_TO_H|SPI_CLK_DIV_16); 
022F:  BCF    14.5
0230:  BSF    03.5
0231:  BCF    06.2
0232:  BSF    06.1
0233:  BCF    06.4
0234:  MOVLW  31
0235:  BCF    03.5
0236:  MOVWF  14
0237:  MOVLW  00
0238:  BSF    03.5
0239:  MOVWF  14
....................    setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); 
023A:  MOVF   01,W
023B:  ANDLW  C7
023C:  IORLW  08
023D:  MOVWF  01
.................... //   setup_timer_1(T1_INTERNAL|T1_DIV_BY_8); 
....................    setup_timer_1(T1_DISABLED|T1_DIV_BY_8); 
023E:  MOVLW  30
023F:  BCF    03.5
0240:  MOVWF  10
....................    setup_timer_2(T2_DIV_BY_16,140,16); 
0241:  MOVLW  78
0242:  MOVWF  78
0243:  IORLW  06
0244:  MOVWF  12
0245:  MOVLW  8C
0246:  BSF    03.5
0247:  MOVWF  12
....................    setup_oscillator(OSC_8MHZ|OSC_INTRC); 
0248:  MOVLW  72
0249:  MOVWF  0F
....................  
....................    STOPR; STOPL;  // zastav motory 
024A:  BCF    05.6
024B:  BCF    03.5
024C:  BCF    05.6
024D:  BSF    03.5
024E:  BCF    05.7
024F:  BCF    03.5
0250:  BCF    05.7
0251:  BSF    03.5
0252:  BCF    05.0
0253:  BCF    03.5
0254:  BCF    05.0
0255:  BSF    03.5
0256:  BCF    05.1
0257:  BCF    03.5
0258:  BCF    05.1
....................    Lmotor=0;Rmotor=0; 
0259:  CLRF   31
025A:  CLRF   30
025B:  CLRF   33
025C:  CLRF   32
....................  
....................    uhel = STRED;    // nastav zadni kolecko na stred 
025D:  MOVLW  80
025E:  MOVWF  2C
....................    rovinka = 0; 
025F:  CLRF   2E
....................  
....................    enable_interrupts(INT_TIMER2); 
0260:  BSF    03.5
0261:  BSF    0C.1
.................... //   enable_interrupts(INT_TIMER1); 
....................    enable_interrupts(GLOBAL); 
0262:  MOVLW  C0
0263:  BCF    03.5
0264:  IORWF  0B,F
....................  
....................    output_low(IRTX); // zapni IR vysilac 
0265:  BSF    03.5
0266:  BCF    06.2
0267:  BCF    03.5
0268:  BCF    06.2
....................  
....................    delay_ms(1000); 
0269:  MOVLW  04
026A:  MOVWF  38
026B:  MOVLW  FA
026C:  MOVWF  3C
026D:  CALL   071
026E:  DECFSZ 38,F
026F:  GOTO   26B
....................  
.................... //!!!! 
.................... speed=SPEEDMAX; 
0270:  MOVLW  8C
0271:  MOVWF  2D
....................  
....................    while(true) 
....................    { 
....................  
....................       GO(L,F,Lmotor);GO(R,F,Rmotor);   // zapni motory PWM podle promenych Lmotor a Rmotor 
0272:  MOVF   01,W
0273:  BTFSS  00.7
0274:  GOTO   278
0275:  BTFSS  31.7
0276:  GOTO   280
0277:  GOTO   27A
0278:  BTFSC  31.7
0279:  GOTO   289
027A:  MOVF   31,F
027B:  BTFSS  03.2
027C:  GOTO   280
027D:  SUBWF  30,W
027E:  BTFSS  03.0
027F:  GOTO   289
0280:  BSF    03.5
0281:  BCF    05.1
0282:  BCF    03.5
0283:  BCF    05.1
0284:  BSF    03.5
0285:  BCF    05.0
0286:  BCF    03.5
0287:  BSF    05.0
0288:  GOTO   291
0289:  BSF    03.5
028A:  BCF    05.0
028B:  BCF    03.5
028C:  BCF    05.0
028D:  BSF    03.5
028E:  BCF    05.1
028F:  BCF    03.5
0290:  BCF    05.1
0291:  MOVF   01,W
0292:  BTFSS  00.7
0293:  GOTO   297
0294:  BTFSS  33.7
0295:  GOTO   29F
0296:  GOTO   299
0297:  BTFSC  33.7
0298:  GOTO   2A8
0299:  MOVF   33,F
029A:  BTFSS  03.2
029B:  GOTO   29F
029C:  SUBWF  32,W
029D:  BTFSS  03.0
029E:  GOTO   2A8
029F:  BSF    03.5
02A0:  BCF    05.7
02A1:  BCF    03.5
02A2:  BCF    05.7
02A3:  BSF    03.5
02A4:  BCF    05.6
02A5:  BCF    03.5
02A6:  BSF    05.6
02A7:  GOTO   2B0
02A8:  BSF    03.5
02A9:  BCF    05.6
02AA:  BCF    03.5
02AB:  BCF    05.6
02AC:  BSF    03.5
02AD:  BCF    05.7
02AE:  BCF    03.5
02AF:  BCF    05.7
....................  
....................       delay_us(1500);                  // cekani na SLAVE, nez pripravi data od cidel 
02B0:  CLRWDT
02B1:  MOVLW  01
02B2:  MOVWF  3C
02B3:  CALL   071
02B4:  MOVLW  02
02B5:  MOVWF  38
02B6:  CLRF   29
02B7:  BTFSC  0B.7
02B8:  BSF    29.7
02B9:  BCF    0B.7
02BA:  MOVLW  F7
02BB:  MOVWF  3F
02BC:  CALL   043
02BD:  BTFSC  29.7
02BE:  BSF    0B.7
02BF:  DECFSZ 38,F
02C0:  GOTO   2B6
....................  
....................       output_low(STROBE);              // vypni zobrazovani na posuvnem registru 
02C1:  BSF    03.5
02C2:  BCF    06.0
02C3:  BCF    03.5
02C4:  BCF    06.0
....................       sensors = spi_read(0);           // cteni senzoru 
02C5:  MOVF   13,W
02C6:  CLRF   13
02C7:  BSF    03.5
02C8:  BTFSC  14.0
02C9:  GOTO   2CC
02CA:  BCF    03.5
02CB:  GOTO   2C7
02CC:  BCF    03.5
02CD:  MOVF   13,W
02CE:  MOVWF  2A
....................       sensors=~sensors; 
02CF:  COMF   2A,F
....................       output_high(STROBE);       // zobraz data na posuvnem registru 
02D0:  BSF    03.5
02D1:  BCF    06.0
02D2:  BCF    03.5
02D3:  BSF    06.0
....................  
....................       i=0;                       // havarijni kod 
02D4:  CLRF   35
....................       for (n=0; n<=6; n++) 
02D5:  CLRF   34
02D6:  MOVF   34,W
02D7:  SUBLW  06
02D8:  BTFSS  03.0
02D9:  GOTO   2E8
....................       { 
....................          if(bit_test(sensors,n)) i++; 
02DA:  MOVF   2A,W
02DB:  MOVWF  77
02DC:  MOVF   34,W
02DD:  MOVWF  78
02DE:  BTFSC  03.2
02DF:  GOTO   2E4
02E0:  BCF    03.0
02E1:  RRF    77,F
02E2:  DECFSZ 78,F
02E3:  GOTO   2E0
02E4:  BTFSC  77.0
02E5:  INCF   35,F
....................       } 
02E6:  INCF   34,F
02E7:  GOTO   2D6
....................       if (i>3) // zastavi, kdyz je cerno pod vice nez tremi cidly 
02E8:  MOVF   35,W
02E9:  SUBLW  03
02EA:  BTFSC  03.0
02EB:  GOTO   314
....................       { 
....................          BL; BR; 
02EC:  BSF    03.5
02ED:  BCF    05.0
02EE:  BCF    03.5
02EF:  BCF    05.0
02F0:  BSF    03.5
02F1:  BCF    05.1
02F2:  BCF    03.5
02F3:  BSF    05.1
02F4:  BSF    03.5
02F5:  BCF    05.6
02F6:  BCF    03.5
02F7:  BCF    05.6
02F8:  BSF    03.5
02F9:  BCF    05.7
02FA:  BCF    03.5
02FB:  BSF    05.7
....................          delay_ms(300); 
02FC:  MOVLW  02
02FD:  MOVWF  38
02FE:  MOVLW  96
02FF:  MOVWF  3C
0300:  CALL   071
0301:  DECFSZ 38,F
0302:  GOTO   2FE
....................          STOPR; STOPL; 
0303:  BSF    03.5
0304:  BCF    05.6
0305:  BCF    03.5
0306:  BCF    05.6
0307:  BSF    03.5
0308:  BCF    05.7
0309:  BCF    03.5
030A:  BCF    05.7
030B:  BSF    03.5
030C:  BCF    05.0
030D:  BCF    03.5
030E:  BCF    05.0
030F:  BSF    03.5
0310:  BCF    05.1
0311:  BCF    03.5
0312:  BCF    05.1
....................          While(true);  
0313:  GOTO   313
....................       }; 
....................        
....................       if(bit_test(sensors,7))    // detekce cihly 
0314:  BTFSS  2A.7
0315:  GOTO   317
....................       { 
....................          objizdka();       // objede cihlu 
0316:  GOTO   089
....................       } 
....................  
....................  
....................       if(bit_test(sensors,3)) //...|...// 
0317:  BTFSS  2A.3
0318:  GOTO   32B
....................       { 
....................          uhel=STRED; 
0319:  MOVLW  80
031A:  MOVWF  2C
....................          Lmotor=speed; 
031B:  CLRF   7A
031C:  MOVF   2D,W
031D:  MOVWF  30
031E:  MOVF   7A,W
031F:  MOVWF  31
....................          Rmotor=speed; 
0320:  CLRF   7A
0321:  MOVF   2D,W
0322:  MOVWF  32
0323:  MOVF   7A,W
0324:  MOVWF  33
....................          line=S; 
0325:  CLRF   2B
.................... //         set_timer1(0); 
....................          if (rovinka < 255) rovinka++; 
0326:  INCFSZ 2E,W
0327:  GOTO   329
0328:  GOTO   32A
0329:  INCF   2E,F
....................          continue; 
032A:  GOTO   272
....................       } 
....................  
....................       if(bit_test(sensors,0)) //|......//     // z duvodu zkraceni doby reakce se cidla nevyhodnocuji poporade ale od krajnich k prostrednimu 
032B:  BTFSS  2A.0
032C:  GOTO   339
....................       { 
....................          uhel=STRED - BEAR3; 
032D:  MOVLW  53
032E:  MOVWF  2C
....................          Lmotor=0; 
032F:  CLRF   31
0330:  CLRF   30
....................          Rmotor=speed; 
0331:  CLRF   7A
0332:  MOVF   2D,W
0333:  MOVWF  32
0334:  MOVF   7A,W
0335:  MOVWF  33
....................          line=L3; 
0336:  MOVLW  03
0337:  MOVWF  2B
.................... //         set_timer1(0); 
....................          continue; 
0338:  GOTO   272
....................       } 
....................  
....................       if(bit_test(sensors,6)) //......|// 
0339:  BTFSS  2A.6
033A:  GOTO   347
....................       { 
....................          uhel=STRED + BEAR3; 
033B:  MOVLW  AD
033C:  MOVWF  2C
....................          Rmotor=0; 
033D:  CLRF   33
033E:  CLRF   32
....................          Lmotor=speed; 
033F:  CLRF   7A
0340:  MOVF   2D,W
0341:  MOVWF  30
0342:  MOVF   7A,W
0343:  MOVWF  31
....................          line=R3; 
0344:  MOVLW  FD
0345:  MOVWF  2B
.................... //         set_timer1(0); 
....................          continue; 
0346:  GOTO   272
....................       } 
....................  
....................       if(bit_test(sensors,1)) //.|.....// 
0347:  BTFSS  2A.1
0348:  GOTO   359
....................       { 
....................          uhel=STRED - BEAR2; 
0349:  MOVLW  67
034A:  MOVWF  2C
....................          Lmotor=speed-50; 
034B:  MOVLW  32
034C:  SUBWF  2D,W
034D:  CLRF   7A
034E:  MOVWF  30
034F:  MOVF   7A,W
0350:  MOVWF  31
....................          Rmotor=speed; 
0351:  CLRF   7A
0352:  MOVF   2D,W
0353:  MOVWF  32
0354:  MOVF   7A,W
0355:  MOVWF  33
....................          line=L2; 
0356:  MOVLW  02
0357:  MOVWF  2B
.................... //         set_timer1(0); 
....................          continue; 
0358:  GOTO   272
....................       } 
....................  
....................       if(bit_test(sensors,5)) //.....|.// 
0359:  BTFSS  2A.5
035A:  GOTO   36B
....................       { 
....................          uhel=STRED + BEAR2; 
035B:  MOVLW  99
035C:  MOVWF  2C
....................          Rmotor=speed-50; 
035D:  MOVLW  32
035E:  SUBWF  2D,W
035F:  CLRF   7A
0360:  MOVWF  32
0361:  MOVF   7A,W
0362:  MOVWF  33
....................          Lmotor=speed; 
0363:  CLRF   7A
0364:  MOVF   2D,W
0365:  MOVWF  30
0366:  MOVF   7A,W
0367:  MOVWF  31
....................          line=R2; 
0368:  MOVLW  FE
0369:  MOVWF  2B
.................... //         set_timer1(0); 
....................          continue; 
036A:  GOTO   272
....................       } 
....................  
....................       if (bit_test(sensors,2)) //..|....// 
036B:  BTFSS  2A.2
036C:  GOTO   380
....................       { 
....................          uhel=STRED - BEAR1; 
036D:  MOVLW  76
036E:  MOVWF  2C
....................          Lmotor=speed; 
036F:  CLRF   7A
0370:  MOVF   2D,W
0371:  MOVWF  30
0372:  MOVF   7A,W
0373:  MOVWF  31
....................          Rmotor=speed; 
0374:  CLRF   7A
0375:  MOVF   2D,W
0376:  MOVWF  32
0377:  MOVF   7A,W
0378:  MOVWF  33
....................          line=L1; 
0379:  MOVLW  01
037A:  MOVWF  2B
.................... //         set_timer1(0); 
....................          if (rovinka<255) rovinka++; 
037B:  INCFSZ 2E,W
037C:  GOTO   37E
037D:  GOTO   37F
037E:  INCF   2E,F
....................          continue; 
037F:  GOTO   272
....................       } 
....................  
....................       if (bit_test(sensors,4)) //....|..// 
0380:  BTFSS  2A.4
0381:  GOTO   395
....................       { 
....................          uhel=STRED + BEAR1; 
0382:  MOVLW  8A
0383:  MOVWF  2C
....................          Rmotor=speed; 
0384:  CLRF   7A
0385:  MOVF   2D,W
0386:  MOVWF  32
0387:  MOVF   7A,W
0388:  MOVWF  33
....................          Lmotor=speed; 
0389:  CLRF   7A
038A:  MOVF   2D,W
038B:  MOVWF  30
038C:  MOVF   7A,W
038D:  MOVWF  31
....................          line=R1; 
038E:  MOVLW  FF
038F:  MOVWF  2B
.................... //         set_timer1(0); 
....................          if (rovinka<255) rovinka++; 
0390:  INCFSZ 2E,W
0391:  GOTO   393
0392:  GOTO   394
0393:  INCF   2E,F
....................          continue; 
0394:  GOTO   272
....................       } 
....................  
....................  
....................       if ((L3==line) || (R3==line)) // Brzdeni pri vyjeti z trate 
0395:  MOVF   2B,W
0396:  SUBLW  03
0397:  BTFSC  03.2
0398:  GOTO   39D
0399:  MOVF   2B,W
039A:  SUBLW  FD
039B:  BTFSS  03.2
039C:  GOTO   3BE
....................       { 
....................          if (rovinka>50) 
039D:  MOVF   2E,W
039E:  SUBLW  32
039F:  BTFSC  03.0
03A0:  GOTO   3BB
....................          { 
....................             BL; BR; 
03A1:  BSF    03.5
03A2:  BCF    05.0
03A3:  BCF    03.5
03A4:  BCF    05.0
03A5:  BSF    03.5
03A6:  BCF    05.1
03A7:  BCF    03.5
03A8:  BSF    05.1
03A9:  BSF    03.5
03AA:  BCF    05.6
03AB:  BCF    03.5
03AC:  BCF    05.6
03AD:  BSF    03.5
03AE:  BCF    05.7
03AF:  BCF    03.5
03B0:  BSF    05.7
....................             Delay_ms(100); 
03B1:  MOVLW  64
03B2:  MOVWF  3C
03B3:  CALL   071
....................             if (rovinka>250) delay_ms(50); 
03B4:  MOVF   2E,W
03B5:  SUBLW  FA
03B6:  BTFSC  03.0
03B7:  GOTO   3BB
03B8:  MOVLW  32
03B9:  MOVWF  3C
03BA:  CALL   071
....................          }; 
....................          rovinka=0; 
03BB:  CLRF   2E
....................          speed=SPEEDMAX; 
03BC:  MOVLW  8C
03BD:  MOVWF  2D
....................       }; 
....................    } 
03BE:  GOTO   272
.................... } 
03BF:  SLEEP

Configuration Fuses:
   Word  1: 3F38   NOWDT NOPUT MCLR NOBROWNOUT NOLVP NOCPD NOWRT NODEBUG CCPB0 NOPROTECT INTRC_IO
   Word  2: 3FFC   NOFCMEN NOIESO