Subversion Repositories svnkaklik

Rev

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

CCS PCM C Compiler, Version 3.245, 27853               23-IV-06 20:13

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

               ROM used: 1012 words (25%)
                         Largest free fragment is 2048
               RAM used: 32 (18%) at main() level
                         38 (22%) 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  40,F
0045:  BTFSS  03.0
0046:  GOTO   052
0047:  MOVLW  40
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  3D
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  R           100         // 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_B5 
....................  
.................... // kroutitka 
.................... #define  CERVENA  5  // AN5 
.................... #define  CERNA    2  // AN2 
.................... #define  ZELENA   4  // AN4 
.................... #define  MODRA    6  // AN6 
....................  
.................... // 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 turn;           // rychlost toceni 
.................... 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;} 
....................  
.................... //////////////////////////////////////////////////////////////////////////////// 
.................... #int_TIMER1 
.................... TIMER1_isr() 
.................... { 
....................    preteceni = true; 
*
003F:  BSF    30.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    06.5
0055:  BCF    03.5
0056:  BSF    06.5
....................    delay_us(1000); 
0057:  CLRWDT
0058:  MOVLW  09
0059:  MOVWF  3F
005A:  MOVLW  6D
005B:  MOVWF  40
005C:  CALL   043
005D:  DECFSZ 3F,F
005E:  GOTO   05A
....................    for(n=uhel; n>0; n--) Delay_us(2); 
005F:  MOVF   2C,W
0060:  MOVWF  3E
0061:  MOVF   3E,F
0062:  BTFSC  03.2
0063:  GOTO   06A
0064:  CLRWDT
0065:  NOP
0066:  NOP
0067:  NOP
0068:  DECF   3E,F
0069:  GOTO   061
....................    output_low(SERVO); 
006A:  BSF    03.5
006B:  BCF    06.5
006C:  BCF    03.5
006D:  BCF    06.5
.................... } 
....................  
.................... //////////////////////////////////////////////////////////////////////////////// 
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   39
....................    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  3C
009C:  MOVLW  C8
009D:  MOVWF  3D
009E:  CALL   071
009F:  DECFSZ 3C,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  3D
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  3D
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  3D
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   3B
00EB:  CLRF   3A
00EC:  MOVF   3B,W
00ED:  SUBLW  03
00EE:  BTFSS  03.0
00EF:  GOTO   157
00F0:  BTFSS  03.2
00F1:  GOTO   0F6
00F2:  MOVF   3A,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
....................       { 
....................          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
....................       { 
....................          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  3D
0152:  CALL   071
....................    } 
0153:  INCF   3A,F
0154:  BTFSC  03.2
0155:  INCF   3B,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  3D
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  3C
017E:  MOVLW  FA
017F:  MOVWF  3D
0180:  CALL   071
0181:  DECFSZ 3C,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  3D
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  3D
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  3C
01B5:  MOVLW  C8
01B6:  MOVWF  3D
01B7:  CALL   071
01B8:  DECFSZ 3C,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  3D
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  3D
01E3:  CALL   071
....................    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  3D
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  3C
0209:  MOVLW  C8
020A:  MOVWF  3D
020B:  CALL   071
020C:  DECFSZ 3C,F
020D:  GOTO   209
....................  
....................    uhel=STRED-BEAR3;    // doleva 
020E:  MOVLW  53
020F:  MOVWF  2C
.................... } 
0210:  BCF    0A.3
0211:  GOTO   343 (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(sAN5|sAN2|sAN4|sAN6|VSS_VDD); // AD pro kroutitka 
*
0221:  BSF    03.5
0222:  BCF    1F.4
0223:  BCF    1F.5
0224:  MOVF   1B,W
0225:  ANDLW  80
0226:  IORLW  74
0227:  MOVWF  1B
....................    setup_adc(ADC_CLOCK_INTERNAL); 
0228:  BCF    1F.6
0229:  BCF    03.5
022A:  BSF    1F.6
022B:  BSF    1F.7
022C:  BSF    03.5
022D:  BCF    1F.7
022E:  BCF    03.5
022F:  BSF    1F.0
....................    setup_spi(SPI_MASTER|SPI_H_TO_L|SPI_XMIT_L_TO_H|SPI_CLK_DIV_16); 
0230:  BCF    14.5
0231:  BSF    03.5
0232:  BCF    06.2
0233:  BSF    06.1
0234:  BCF    06.4
0235:  MOVLW  31
0236:  BCF    03.5
0237:  MOVWF  14
0238:  MOVLW  00
0239:  BSF    03.5
023A:  MOVWF  14
....................    setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); 
023B:  MOVF   01,W
023C:  ANDLW  C7
023D:  IORLW  08
023E:  MOVWF  01
....................    setup_timer_1(T1_DISABLED|T1_DIV_BY_8); 
023F:  MOVLW  30
0240:  BCF    03.5
0241:  MOVWF  10
....................    setup_timer_2(T2_DIV_BY_16,140,16); 
0242:  MOVLW  78
0243:  MOVWF  78
0244:  IORLW  06
0245:  MOVWF  12
0246:  MOVLW  8C
0247:  BSF    03.5
0248:  MOVWF  12
....................    setup_oscillator(OSC_8MHZ|OSC_INTRC); 
0249:  MOVLW  72
024A:  MOVWF  0F
....................  
....................    STOPR; STOPL;  // zastav motory 
024B:  BCF    05.6
024C:  BCF    03.5
024D:  BCF    05.6
024E:  BSF    03.5
024F:  BCF    05.7
0250:  BCF    03.5
0251:  BCF    05.7
0252:  BSF    03.5
0253:  BCF    05.0
0254:  BCF    03.5
0255:  BCF    05.0
0256:  BSF    03.5
0257:  BCF    05.1
0258:  BCF    03.5
0259:  BCF    05.1
....................    Lmotor=0;Rmotor=0; 
025A:  CLRF   32
025B:  CLRF   31
025C:  CLRF   34
025D:  CLRF   33
....................  
....................    uhel = STRED;    // nastav zadni kolecko na stred 
025E:  MOVLW  80
025F:  MOVWF  2C
....................    rovinka = 0; 
0260:  CLRF   2F
....................  
....................    enable_interrupts(INT_TIMER2); 
0261:  BSF    03.5
0262:  BSF    0C.1
....................    enable_interrupts(GLOBAL); 
0263:  MOVLW  C0
0264:  BCF    03.5
0265:  IORWF  0B,F
....................  
....................    output_low(IRTX); // zapni IR vysilac 
0266:  BSF    03.5
0267:  BCF    06.2
0268:  BCF    03.5
0269:  BCF    06.2
....................  
....................    delay_ms(1500); // musime pockat na diagnostiku slave CPU 
026A:  MOVLW  06
026B:  MOVWF  39
026C:  MOVLW  FA
026D:  MOVWF  3D
026E:  CALL   071
026F:  DECFSZ 39,F
0270:  GOTO   26C
....................  
....................    //nastaveni rychlosti 
....................    set_adc_channel(CERVENA); 
0271:  MOVLW  28
0272:  MOVWF  78
0273:  MOVF   1F,W
0274:  ANDLW  C7
0275:  IORWF  78,W
0276:  MOVWF  1F
....................    Delay_ms(1); 
0277:  MOVLW  01
0278:  MOVWF  3D
0279:  CALL   071
....................    speed=R+(read_adc()>>2); // rychlost rovne +63; kroutitko dava 0-63 
027A:  BSF    1F.2
027B:  BTFSC  1F.2
027C:  GOTO   27B
027D:  MOVF   1E,W
027E:  MOVWF  77
027F:  RRF    77,F
0280:  RRF    77,F
0281:  MOVLW  3F
0282:  ANDWF  77,F
0283:  MOVF   77,W
0284:  ADDLW  64
0285:  MOVWF  2D
....................    set_adc_channel(MODRA); 
0286:  MOVLW  30
0287:  MOVWF  78
0288:  MOVF   1F,W
0289:  ANDLW  C7
028A:  IORWF  78,W
028B:  MOVWF  1F
....................    Delay_ms(1); 
028C:  MOVLW  01
028D:  MOVWF  3D
028E:  CALL   071
....................    turn=speed-32+(read_adc()>>2);  // rychlost toceni +-32; kroutitko dava 0-63 
028F:  MOVLW  20
0290:  SUBWF  2D,W
0291:  MOVWF  39
0292:  BSF    1F.2
0293:  BTFSC  1F.2
0294:  GOTO   293
0295:  MOVF   1E,W
0296:  MOVWF  77
0297:  RRF    77,F
0298:  RRF    77,F
0299:  MOVLW  3F
029A:  ANDWF  77,F
029B:  MOVF   77,W
029C:  ADDWF  39,W
029D:  MOVWF  2E
....................    while(true) 
....................    { 
....................  
....................       GO(L,F,Lmotor);GO(R,F,Rmotor);   // zapni motory PWM podle promenych Lmotor a Rmotor 
029E:  MOVF   01,W
029F:  BTFSS  00.7
02A0:  GOTO   2A4
02A1:  BTFSS  32.7
02A2:  GOTO   2AC
02A3:  GOTO   2A6
02A4:  BTFSC  32.7
02A5:  GOTO   2B5
02A6:  MOVF   32,F
02A7:  BTFSS  03.2
02A8:  GOTO   2AC
02A9:  SUBWF  31,W
02AA:  BTFSS  03.0
02AB:  GOTO   2B5
02AC:  BSF    03.5
02AD:  BCF    05.1
02AE:  BCF    03.5
02AF:  BCF    05.1
02B0:  BSF    03.5
02B1:  BCF    05.0
02B2:  BCF    03.5
02B3:  BSF    05.0
02B4:  GOTO   2BD
02B5:  BSF    03.5
02B6:  BCF    05.0
02B7:  BCF    03.5
02B8:  BCF    05.0
02B9:  BSF    03.5
02BA:  BCF    05.1
02BB:  BCF    03.5
02BC:  BCF    05.1
02BD:  MOVF   01,W
02BE:  BTFSS  00.7
02BF:  GOTO   2C3
02C0:  BTFSS  34.7
02C1:  GOTO   2CB
02C2:  GOTO   2C5
02C3:  BTFSC  34.7
02C4:  GOTO   2D4
02C5:  MOVF   34,F
02C6:  BTFSS  03.2
02C7:  GOTO   2CB
02C8:  SUBWF  33,W
02C9:  BTFSS  03.0
02CA:  GOTO   2D4
02CB:  BSF    03.5
02CC:  BCF    05.7
02CD:  BCF    03.5
02CE:  BCF    05.7
02CF:  BSF    03.5
02D0:  BCF    05.6
02D1:  BCF    03.5
02D2:  BSF    05.6
02D3:  GOTO   2DC
02D4:  BSF    03.5
02D5:  BCF    05.6
02D6:  BCF    03.5
02D7:  BCF    05.6
02D8:  BSF    03.5
02D9:  BCF    05.7
02DA:  BCF    03.5
02DB:  BCF    05.7
....................  
....................       delay_us(2000);                  // cekani na SLAVE, nez pripravi data od cidel 
02DC:  CLRWDT
02DD:  MOVLW  01
02DE:  MOVWF  3D
02DF:  CALL   071
02E0:  MOVLW  09
02E1:  MOVWF  39
02E2:  CLRF   29
02E3:  BTFSC  0B.7
02E4:  BSF    29.7
02E5:  BCF    0B.7
02E6:  MOVLW  6D
02E7:  MOVWF  40
02E8:  CALL   043
02E9:  BTFSC  29.7
02EA:  BSF    0B.7
02EB:  DECFSZ 39,F
02EC:  GOTO   2E2
....................  
....................       output_low(STROBE);              // vypni zobrazovani na posuvnem registru 
02ED:  BSF    03.5
02EE:  BCF    06.0
02EF:  BCF    03.5
02F0:  BCF    06.0
....................       sensors = spi_read(0);           // cteni senzoru 
02F1:  MOVF   13,W
02F2:  CLRF   13
02F3:  BSF    03.5
02F4:  BTFSC  14.0
02F5:  GOTO   2F8
02F6:  BCF    03.5
02F7:  GOTO   2F3
02F8:  BCF    03.5
02F9:  MOVF   13,W
02FA:  MOVWF  2A
....................       sensors=~sensors; 
02FB:  COMF   2A,F
....................       output_high(STROBE);       // zobraz data na posuvnem registru 
02FC:  BSF    03.5
02FD:  BCF    06.0
02FE:  BCF    03.5
02FF:  BSF    06.0
....................  
....................       i=0;                       // havarijni kod 
0300:  CLRF   36
....................       for (n=0; n<=6; n++) 
0301:  CLRF   35
0302:  MOVF   35,W
0303:  SUBLW  06
0304:  BTFSS  03.0
0305:  GOTO   314
....................       { 
....................          if(bit_test(sensors,n)) i++; 
0306:  MOVF   2A,W
0307:  MOVWF  77
0308:  MOVF   35,W
0309:  MOVWF  78
030A:  BTFSC  03.2
030B:  GOTO   310
030C:  BCF    03.0
030D:  RRF    77,F
030E:  DECFSZ 78,F
030F:  GOTO   30C
0310:  BTFSC  77.0
0311:  INCF   36,F
....................       } 
0312:  INCF   35,F
0313:  GOTO   302
....................       if (i>3) // zastavi, kdyz je cerno pod vice nez tremi cidly 
0314:  MOVF   36,W
0315:  SUBLW  03
0316:  BTFSC  03.0
0317:  GOTO   340
....................       { 
....................          BL; BR; 
0318:  BSF    03.5
0319:  BCF    05.0
031A:  BCF    03.5
031B:  BCF    05.0
031C:  BSF    03.5
031D:  BCF    05.1
031E:  BCF    03.5
031F:  BSF    05.1
0320:  BSF    03.5
0321:  BCF    05.6
0322:  BCF    03.5
0323:  BCF    05.6
0324:  BSF    03.5
0325:  BCF    05.7
0326:  BCF    03.5
0327:  BSF    05.7
....................          delay_ms(300); 
0328:  MOVLW  02
0329:  MOVWF  39
032A:  MOVLW  96
032B:  MOVWF  3D
032C:  CALL   071
032D:  DECFSZ 39,F
032E:  GOTO   32A
....................          STOPR; STOPL; 
032F:  BSF    03.5
0330:  BCF    05.6
0331:  BCF    03.5
0332:  BCF    05.6
0333:  BSF    03.5
0334:  BCF    05.7
0335:  BCF    03.5
0336:  BCF    05.7
0337:  BSF    03.5
0338:  BCF    05.0
0339:  BCF    03.5
033A:  BCF    05.0
033B:  BSF    03.5
033C:  BCF    05.1
033D:  BCF    03.5
033E:  BCF    05.1
....................          While(true); 
033F:  GOTO   33F
....................       }; 
....................  
....................       if(bit_test(sensors,7))    // detekce cihly 
0340:  BTFSS  2A.7
0341:  GOTO   343
....................       { 
....................          objizdka();       // objede cihlu 
0342:  GOTO   089
....................       } 
....................  
....................  
....................       if(bit_test(sensors,3)) //...|...// 
0343:  BTFSS  2A.3
0344:  GOTO   361
....................       { 
....................          uhel=STRED; 
0345:  MOVLW  80
0346:  MOVWF  2C
....................          if (rovinka<50) 
0347:  MOVF   2F,W
0348:  SUBLW  31
0349:  BTFSS  03.0
034A:  GOTO   351
....................          { 
....................             Lmotor=R17; 
034B:  CLRF   32
034C:  MOVLW  FF
034D:  MOVWF  31
....................             Rmotor=R17; 
034E:  CLRF   34
034F:  MOVWF  33
....................          } 
....................          else 
0350:  GOTO   35B
....................          { 
....................             Lmotor=speed; 
0351:  CLRF   7A
0352:  MOVF   2D,W
0353:  MOVWF  31
0354:  MOVF   7A,W
0355:  MOVWF  32
....................             Rmotor=speed; 
0356:  CLRF   7A
0357:  MOVF   2D,W
0358:  MOVWF  33
0359:  MOVF   7A,W
035A:  MOVWF  34
....................          };          
....................          line=S; 
035B:  CLRF   2B
....................          if (rovinka < 255) rovinka++; 
035C:  INCFSZ 2F,W
035D:  GOTO   35F
035E:  GOTO   360
035F:  INCF   2F,F
....................          continue; 
0360:  GOTO   29E
....................       } 
....................  
....................       if(bit_test(sensors,0)) //|......//     // z duvodu zkraceni doby reakce se cidla nevyhodnocuji poporade ale od krajnich k prostrednimu 
0361:  BTFSS  2A.0
0362:  GOTO   36F
....................       { 
....................          uhel=STRED - BEAR3; 
0363:  MOVLW  53
0364:  MOVWF  2C
....................          Lmotor=0; 
0365:  CLRF   32
0366:  CLRF   31
....................          Rmotor=turn; 
0367:  CLRF   7A
0368:  MOVF   2E,W
0369:  MOVWF  33
036A:  MOVF   7A,W
036B:  MOVWF  34
....................          line=L3; 
036C:  MOVLW  03
036D:  MOVWF  2B
....................          continue; 
036E:  GOTO   29E
....................       } 
....................  
....................       if(bit_test(sensors,6)) //......|// 
036F:  BTFSS  2A.6
0370:  GOTO   37D
....................       { 
....................          uhel=STRED + BEAR3; 
0371:  MOVLW  AD
0372:  MOVWF  2C
....................          Rmotor=0; 
0373:  CLRF   34
0374:  CLRF   33
....................          Lmotor=turn; 
0375:  CLRF   7A
0376:  MOVF   2E,W
0377:  MOVWF  31
0378:  MOVF   7A,W
0379:  MOVWF  32
....................          line=R3; 
037A:  MOVLW  FD
037B:  MOVWF  2B
....................          continue; 
037C:  GOTO   29E
....................       } 
....................  
....................       if(bit_test(sensors,1)) //.|.....// 
037D:  BTFSS  2A.1
037E:  GOTO   38F
....................       { 
....................          uhel=STRED - BEAR2; 
037F:  MOVLW  67
0380:  MOVWF  2C
....................          Lmotor=speed-50; 
0381:  MOVLW  32
0382:  SUBWF  2D,W
0383:  CLRF   7A
0384:  MOVWF  31
0385:  MOVF   7A,W
0386:  MOVWF  32
....................          Rmotor=speed; 
0387:  CLRF   7A
0388:  MOVF   2D,W
0389:  MOVWF  33
038A:  MOVF   7A,W
038B:  MOVWF  34
....................          line=L2; 
038C:  MOVLW  02
038D:  MOVWF  2B
....................          continue; 
038E:  GOTO   29E
....................       } 
....................  
....................       if(bit_test(sensors,5)) //.....|.// 
038F:  BTFSS  2A.5
0390:  GOTO   3A1
....................       { 
....................          uhel=STRED + BEAR2; 
0391:  MOVLW  99
0392:  MOVWF  2C
....................          Rmotor=speed-50; 
0393:  MOVLW  32
0394:  SUBWF  2D,W
0395:  CLRF   7A
0396:  MOVWF  33
0397:  MOVF   7A,W
0398:  MOVWF  34
....................          Lmotor=speed; 
0399:  CLRF   7A
039A:  MOVF   2D,W
039B:  MOVWF  31
039C:  MOVF   7A,W
039D:  MOVWF  32
....................          line=R2; 
039E:  MOVLW  FE
039F:  MOVWF  2B
....................          continue; 
03A0:  GOTO   29E
....................       } 
....................  
....................       if (bit_test(sensors,2)) //..|....// 
03A1:  BTFSS  2A.2
03A2:  GOTO   3B6
....................       { 
....................          uhel=STRED - BEAR1; 
03A3:  MOVLW  76
03A4:  MOVWF  2C
....................          Lmotor=speed; 
03A5:  CLRF   7A
03A6:  MOVF   2D,W
03A7:  MOVWF  31
03A8:  MOVF   7A,W
03A9:  MOVWF  32
....................          Rmotor=speed; 
03AA:  CLRF   7A
03AB:  MOVF   2D,W
03AC:  MOVWF  33
03AD:  MOVF   7A,W
03AE:  MOVWF  34
....................          line=L1; 
03AF:  MOVLW  01
03B0:  MOVWF  2B
....................          if (rovinka<255) rovinka++; 
03B1:  INCFSZ 2F,W
03B2:  GOTO   3B4
03B3:  GOTO   3B5
03B4:  INCF   2F,F
....................          continue; 
03B5:  GOTO   29E
....................       } 
....................  
....................       if (bit_test(sensors,4)) //....|..// 
03B6:  BTFSS  2A.4
03B7:  GOTO   3CB
....................       { 
....................          uhel=STRED + BEAR1; 
03B8:  MOVLW  8A
03B9:  MOVWF  2C
....................          Rmotor=speed; 
03BA:  CLRF   7A
03BB:  MOVF   2D,W
03BC:  MOVWF  33
03BD:  MOVF   7A,W
03BE:  MOVWF  34
....................          Lmotor=speed; 
03BF:  CLRF   7A
03C0:  MOVF   2D,W
03C1:  MOVWF  31
03C2:  MOVF   7A,W
03C3:  MOVWF  32
....................          line=R1; 
03C4:  MOVLW  FF
03C5:  MOVWF  2B
....................          if (rovinka<255) rovinka++; 
03C6:  INCFSZ 2F,W
03C7:  GOTO   3C9
03C8:  GOTO   3CA
03C9:  INCF   2F,F
....................          continue; 
03CA:  GOTO   29E
....................       } 
....................  
....................  
....................       if ((L3==line) || (R3==line)) // Brzdeni pri vyjeti z trate 
03CB:  MOVF   2B,W
03CC:  SUBLW  03
03CD:  BTFSC  03.2
03CE:  GOTO   3D3
03CF:  MOVF   2B,W
03D0:  SUBLW  FD
03D1:  BTFSS  03.2
03D2:  GOTO   3F2
....................       { 
....................          if (rovinka>50) 
03D3:  MOVF   2F,W
03D4:  SUBLW  32
03D5:  BTFSC  03.0
03D6:  GOTO   3F1
....................          { 
....................             BL; BR; 
03D7:  BSF    03.5
03D8:  BCF    05.0
03D9:  BCF    03.5
03DA:  BCF    05.0
03DB:  BSF    03.5
03DC:  BCF    05.1
03DD:  BCF    03.5
03DE:  BSF    05.1
03DF:  BSF    03.5
03E0:  BCF    05.6
03E1:  BCF    03.5
03E2:  BCF    05.6
03E3:  BSF    03.5
03E4:  BCF    05.7
03E5:  BCF    03.5
03E6:  BSF    05.7
....................             Delay_ms(100); 
03E7:  MOVLW  64
03E8:  MOVWF  3D
03E9:  CALL   071
....................             if (rovinka>250) delay_ms(50); 
03EA:  MOVF   2F,W
03EB:  SUBLW  FA
03EC:  BTFSC  03.0
03ED:  GOTO   3F1
03EE:  MOVLW  32
03EF:  MOVWF  3D
03F0:  CALL   071
....................          }; 
....................          rovinka=0; 
03F1:  CLRF   2F
....................       }; 
....................    } 
03F2:  GOTO   29E
.................... } 
03F3:  SLEEP

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