Subversion Repositories svnkaklik

Rev

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

CCS PCM C Compiler, Version 3.245, 27853               03-IV-06 20:04

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

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

*
0000:  MOVLW  00
0001:  MOVWF  0A
0002:  GOTO   112
0003:  NOP
.................... #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) 
000C:  MOVLW  3C
000D:  MOVWF  04
000E:  MOVF   00,W
000F:  BTFSC  03.2
0010:  GOTO   023
0011:  MOVLW  02
0012:  MOVWF  78
0013:  MOVLW  BF
0014:  MOVWF  77
0015:  CLRWDT
0016:  DECFSZ 77,F
0017:  GOTO   015
0018:  DECFSZ 78,F
0019:  GOTO   013
001A:  MOVLW  96
001B:  MOVWF  77
001C:  DECFSZ 77,F
001D:  GOTO   01C
001E:  NOP
001F:  NOP
0020:  CLRWDT
0021:  DECFSZ 00,F
0022:  GOTO   011
0023:  RETLW  00
0024:  MOVLW  08
0025:  SUBWF  3E,F
0026:  BTFSS  03.0
0027:  GOTO   033
0028:  MOVLW  3E
0029:  MOVWF  04
002A:  BCF    03.0
002B:  RRF    00,F
002C:  MOVF   00,W
002D:  BTFSC  03.2
002E:  GOTO   033
002F:  GOTO   031
0030:  CLRWDT
0031:  DECFSZ 00,F
0032:  GOTO   030
0033:  RETLW  00
....................  
....................  
....................  
.................... #use rtos (timer=2, minor_cycle=2ms) 
....................  
.................... 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 
....................  
.................... signed int16  Lmotor;         // promene, ktere urcuji velikost vykonu na levem 
.................... signed int16  Rmotor;         // a pravem motoru 
....................  
.................... #define  STRED       128      // sredni poloha zadniho kolecka 
.................... #define  BEAR1       20       // 3 stupne zataceni 
.................... #define  BEAR2       40 
.................... #define  BEAR3       60 
.................... // servo 
.................... #define  SERVO PIN_A2 
....................  
.................... //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 
....................  
.................... // makro pro PWM 
.................... #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); 
.................... } 
.................... */ 
.................... //////////////////////////////////////////////////////////////////////////////// 
.................... #task (rate=16ms,max=2ms) 
.................... void zatoc()   // ridi servo ktere otaci kolem 
.................... { 
....................    unsigned int8 n; 
....................  
....................    output_high(SERVO); 
0034:  BSF    03.5
0035:  BCF    05.2
0036:  BCF    03.5
0037:  BSF    05.2
....................    delay_us(1100); 
0038:  CLRWDT
0039:  MOVLW  01
003A:  MOVWF  3C
003B:  CALL   00C
003C:  MOVLW  63
003D:  MOVWF  3E
003E:  CALL   024
....................    for(n=uhel; n>0; n--); 
003F:  MOVF   24,W
0040:  MOVWF  3B
0041:  MOVF   3B,F
0042:  BTFSC  03.2
0043:  GOTO   046
0044:  DECF   3B,F
0045:  GOTO   041
....................    output_low(SERVO); 
0046:  BSF    03.5
0047:  BCF    05.2
0048:  BCF    03.5
0049:  BCF    05.2
.................... } 
004A:  MOVLW  34
004B:  MOVWF  2E
004C:  MOVLW  00
004D:  MOVWF  2F
004E:  BCF    0A.3
004F:  GOTO   1BF
0050:  RETLW  00
....................  
....................  
.................... void diag()   // ridi servo ktere otaci kolem 
.................... { 
....................    unsigned int8 n; 
....................  
....................    output_high(SERVO); 
*
00FA:  BSF    03.5
00FB:  BCF    05.2
00FC:  BCF    03.5
00FD:  BSF    05.2
....................    delay_us(1100); 
00FE:  CLRWDT
00FF:  MOVLW  01
0100:  MOVWF  3C
0101:  CALL   00C
0102:  MOVLW  63
0103:  MOVWF  3E
0104:  CALL   024
....................    for(n=uhel; n>0; n--); 
0105:  MOVF   24,W
0106:  MOVWF  39
0107:  MOVF   39,F
0108:  BTFSC  03.2
0109:  GOTO   10C
010A:  DECF   39,F
010B:  GOTO   107
....................    output_low(SERVO); 
010C:  BSF    03.5
010D:  BCF    05.2
010E:  BCF    03.5
010F:  BCF    05.2
.................... } 
0110:  BCF    0A.3
0111:  GOTO   15B (RETURN)
....................  
.................... //////////////////////////////////////////////////////////////////////////////// 
.................... #task (rate=2ms, max=1ms) 
.................... void rizeni() 
.................... { 
....................    GO(L,F,Lmotor);GO(R,F,Rmotor); 
*
0051:  MOVF   01,W
0052:  BTFSS  00.7
0053:  GOTO   057
0054:  BTFSS  26.7
0055:  GOTO   05F
0056:  GOTO   059
0057:  BTFSC  26.7
0058:  GOTO   068
0059:  MOVF   26,F
005A:  BTFSS  03.2
005B:  GOTO   05F
005C:  SUBWF  25,W
005D:  BTFSS  03.0
005E:  GOTO   068
005F:  BSF    03.5
0060:  BCF    05.1
0061:  BCF    03.5
0062:  BCF    05.1
0063:  BSF    03.5
0064:  BCF    05.0
0065:  BCF    03.5
0066:  BSF    05.0
0067:  GOTO   070
0068:  BSF    03.5
0069:  BCF    05.0
006A:  BCF    03.5
006B:  BCF    05.0
006C:  BSF    03.5
006D:  BCF    05.1
006E:  BCF    03.5
006F:  BCF    05.1
0070:  MOVF   01,W
0071:  BTFSS  00.7
0072:  GOTO   076
0073:  BTFSS  28.7
0074:  GOTO   07E
0075:  GOTO   078
0076:  BTFSC  28.7
0077:  GOTO   087
0078:  MOVF   28,F
0079:  BTFSS  03.2
007A:  GOTO   07E
007B:  SUBWF  27,W
007C:  BTFSS  03.0
007D:  GOTO   087
007E:  BSF    03.5
007F:  BCF    05.7
0080:  BCF    03.5
0081:  BCF    05.7
0082:  BSF    03.5
0083:  BCF    05.6
0084:  BCF    03.5
0085:  BSF    05.6
0086:  GOTO   08F
0087:  BSF    03.5
0088:  BCF    05.6
0089:  BCF    03.5
008A:  BCF    05.6
008B:  BSF    03.5
008C:  BCF    05.7
008D:  BCF    03.5
008E:  BCF    05.7
....................  
....................    delay_us(500); 
008F:  CLRWDT
0090:  MOVLW  02
0091:  MOVWF  3D
0092:  MOVLW  F7
0093:  MOVWF  3E
0094:  CALL   024
0095:  DECFSZ 3D,F
0096:  GOTO   092
....................  
....................    output_low(STROBE); 
0097:  BSF    03.5
0098:  BCF    06.0
0099:  BCF    03.5
009A:  BCF    06.0
....................    sensors = spi_read(0);         // cteni senzoru na caru 
009B:  MOVF   13,W
009C:  CLRF   13
009D:  BSF    03.5
009E:  BTFSC  14.0
009F:  GOTO   0A2
00A0:  BCF    03.5
00A1:  GOTO   09D
00A2:  BCF    03.5
00A3:  MOVF   13,W
00A4:  MOVWF  21
....................    output_high(STROBE); 
00A5:  BSF    03.5
00A6:  BCF    06.0
00A7:  BCF    03.5
00A8:  BSF    06.0
....................  
....................    if(bit_test(sensors,0)) //|......//     // z duvodu zkraceni doby reakce se cidla nevyhodnocuji poporade ale od krajnich k prostrednimu 
00A9:  BTFSS  21.0
00AA:  GOTO   0B3
....................    { 
....................       uhel=STRED+BEAR3; 
00AB:  MOVLW  BC
00AC:  MOVWF  24
....................       Lmotor=0;Rmotor=190; 
00AD:  CLRF   26
00AE:  CLRF   25
00AF:  CLRF   28
00B0:  MOVLW  BE
00B1:  MOVWF  27
....................       return; 
00B2:  GOTO   0F3
....................    } 
....................  
....................    if(bit_test(sensors,6)) //......|// 
00B3:  BTFSS  21.6
00B4:  GOTO   0BD
....................    { 
....................       Rmotor=0;Lmotor=190; 
00B5:  CLRF   28
00B6:  CLRF   27
00B7:  CLRF   26
00B8:  MOVLW  BE
00B9:  MOVWF  25
....................       uhel=STRED-BEAR3; 
00BA:  MOVLW  44
00BB:  MOVWF  24
....................       return; 
00BC:  GOTO   0F3
....................  
....................    } 
....................  
....................    if(bit_test(sensors,1)) //.|.....// 
00BD:  BTFSS  21.1
00BE:  GOTO   0C8
....................    { 
....................       uhel=STRED+BEAR2; 
00BF:  MOVLW  A8
00C0:  MOVWF  24
....................       Lmotor=150;Rmotor=190; 
00C1:  CLRF   26
00C2:  MOVLW  96
00C3:  MOVWF  25
00C4:  CLRF   28
00C5:  MOVLW  BE
00C6:  MOVWF  27
....................       return; 
00C7:  GOTO   0F3
....................    } 
....................  
....................    if(bit_test(sensors,5)) //.....|.// 
00C8:  BTFSS  21.5
00C9:  GOTO   0D3
....................    { 
....................       uhel=STRED-BEAR2; 
00CA:  MOVLW  58
00CB:  MOVWF  24
....................       Rmotor=150;Lmotor=190; 
00CC:  CLRF   28
00CD:  MOVLW  96
00CE:  MOVWF  27
00CF:  CLRF   26
00D0:  MOVLW  BE
00D1:  MOVWF  25
....................       return; 
00D2:  GOTO   0F3
....................    } 
....................  
....................    if (bit_test(sensors,2)) //..|....// 
00D3:  BTFSS  21.2
00D4:  GOTO   0DE
....................    { 
....................       uhel=STRED+BEAR1; 
00D5:  MOVLW  94
00D6:  MOVWF  24
....................       Lmotor=150;Rmotor=190; 
00D7:  CLRF   26
00D8:  MOVLW  96
00D9:  MOVWF  25
00DA:  CLRF   28
00DB:  MOVLW  BE
00DC:  MOVWF  27
....................       return; 
00DD:  GOTO   0F3
....................    } 
....................  
....................    if (bit_test(sensors,4)) //....|..// 
00DE:  BTFSS  21.4
00DF:  GOTO   0E9
....................    { 
....................       uhel=STRED-BEAR1; 
00E0:  MOVLW  6C
00E1:  MOVWF  24
....................       Rmotor=150;Lmotor=190; 
00E2:  CLRF   28
00E3:  MOVLW  96
00E4:  MOVWF  27
00E5:  CLRF   26
00E6:  MOVLW  BE
00E7:  MOVWF  25
....................       return; 
00E8:  GOTO   0F3
....................    } 
....................  
....................    if(bit_test(sensors,3)) //...|...// 
00E9:  BTFSS  21.3
00EA:  GOTO   0F3
....................    { 
....................       uhel=STRED; 
00EB:  MOVLW  80
00EC:  MOVWF  24
....................       Lmotor=190;Rmotor=190; 
00ED:  CLRF   26
00EE:  MOVLW  BE
00EF:  MOVWF  25
00F0:  CLRF   28
00F1:  MOVWF  27
....................       return; 
00F2:  GOTO   0F3
....................    } 
....................  
.................... /*STOPL;STOPR; 
....................       if(bit_test(sensors,7)) 
....................       { 
....................  
....................       }*/ 
.................... } 
00F3:  MOVLW  51
00F4:  MOVWF  35
00F5:  MOVLW  00
00F6:  MOVWF  36
00F7:  BCF    0A.3
00F8:  GOTO   1BF
00F9:  RETLW  00
....................  
....................  
.................... //////////////////////////////////////////////////////////////////////////////// 
.................... void main() 
.................... { 
*
0112:  CLRF   04
0113:  MOVLW  1F
0114:  ANDWF  03,F
0115:  MOVLW  70
0116:  BSF    03.5
0117:  MOVWF  0F
0118:  BCF    1F.4
0119:  BCF    1F.5
011A:  MOVF   1B,W
011B:  ANDLW  80
011C:  MOVWF  1B
011D:  MOVLW  07
011E:  MOVWF  1C
....................    unsigned int16 i; 
....................  
....................    setup_adc_ports(NO_ANALOGS); 
011F:  BCF    1F.4
0120:  BCF    1F.5
0121:  MOVF   1B,W
0122:  ANDLW  80
0123:  MOVWF  1B
....................    setup_adc(ADC_CLOCK_INTERNAL); 
0124:  BCF    1F.6
0125:  BCF    03.5
0126:  BSF    1F.6
0127:  BSF    1F.7
0128:  BSF    03.5
0129:  BCF    1F.7
012A:  BCF    03.5
012B:  BSF    1F.0
....................    setup_spi(SPI_MASTER|SPI_H_TO_L|SPI_XMIT_L_TO_H|SPI_CLK_DIV_4); 
012C:  BCF    14.5
012D:  BSF    03.5
012E:  BCF    06.2
012F:  BSF    06.1
0130:  BCF    06.4
0131:  MOVLW  30
0132:  BCF    03.5
0133:  MOVWF  14
0134:  MOVLW  00
0135:  BSF    03.5
0136:  MOVWF  14
....................    setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1); 
0137:  MOVF   01,W
0138:  ANDLW  C7
0139:  IORLW  08
013A:  MOVWF  01
....................    setup_timer_1(T1_DISABLED); 
013B:  BCF    03.5
013C:  CLRF   10
....................    setup_oscillator(OSC_8MHZ|OSC_INTRC); 
013D:  MOVLW  72
013E:  BSF    03.5
013F:  MOVWF  0F
....................  
....................    STOPR; STOPL; 
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:  BCF    05.7
0147:  BSF    03.5
0148:  BCF    05.0
0149:  BCF    03.5
014A:  BCF    05.0
014B:  BSF    03.5
014C:  BCF    05.1
014D:  BCF    03.5
014E:  BCF    05.1
....................    uhel=STRED; 
014F:  MOVLW  80
0150:  MOVWF  24
....................  
....................    for(i=0;i<100;i++) 
0151:  CLRF   38
0152:  CLRF   37
0153:  MOVF   38,F
0154:  BTFSS  03.2
0155:  GOTO   162
0156:  MOVF   37,W
0157:  SUBLW  63
0158:  BTFSS  03.0
0159:  GOTO   162
....................    { 
....................       diag(); 
015A:  GOTO   0FA
....................       delay_ms(16); 
015B:  MOVLW  10
015C:  MOVWF  3C
015D:  CALL   00C
....................    } 
015E:  INCF   37,F
015F:  BTFSC  03.2
0160:  INCF   38,F
0161:  GOTO   153
.................... //      diagnostika(); 
.................... Lmotor=0; 
0162:  CLRF   26
0163:  CLRF   25
.................... Rmotor=0; 
0164:  CLRF   28
0165:  CLRF   27
....................    rtos_run(); 
0166:  CLRF   29
0167:  CLRF   2B
0168:  MOVLW  08
0169:  MOVWF  2A
016A:  CLRF   2D
016B:  CLRF   2C
016C:  MOVLW  34
016D:  MOVWF  2E
016E:  MOVLW  00
016F:  MOVWF  2F
0170:  CLRF   30
0171:  CLRF   32
0172:  MOVLW  01
0173:  MOVWF  31
0174:  CLRF   34
0175:  CLRF   33
0176:  MOVLW  51
0177:  MOVWF  35
0178:  MOVLW  00
0179:  MOVWF  36
017A:  CLRF   20
017B:  MOVLW  00
017C:  MOVWF  78
017D:  IORLW  06
017E:  MOVWF  12
017F:  MOVLW  FA
0180:  BSF    03.5
0181:  MOVWF  12
0182:  BCF    03.5
0183:  BCF    0C.1
0184:  MOVLW  00
0185:  MOVWF  78
0186:  IORLW  06
0187:  MOVWF  12
0188:  MOVLW  FA
0189:  BSF    03.5
018A:  MOVWF  12
018B:  BCF    03.5
018C:  BCF    0C.1
018D:  BCF    03.0
018E:  RLF    20,W
018F:  MOVWF  77
0190:  CALL   004
0191:  MOVWF  79
0192:  MOVLW  01
0193:  ADDWF  77,W
0194:  CALL   004
0195:  MOVWF  7A
0196:  MOVF   79,W
0197:  MOVWF  04
0198:  MOVF   00,W
0199:  MOVWF  79
019A:  INCF   04,F
019B:  MOVF   00,W
019C:  MOVWF  77
019D:  INCF   04,F
019E:  MOVF   00,W
019F:  MOVWF  78
01A0:  INCF   04,F
01A1:  INCF   00,F
01A2:  MOVF   00,W
01A3:  MOVWF  7A
01A4:  BTFSS  03.2
01A5:  GOTO   1A9
01A6:  INCF   04,F
01A7:  INCF   00,F
01A8:  DECF   04,F
01A9:  INCF   04,F
01AA:  MOVF   00,W
01AB:  SUBWF  78,W
01AC:  BTFSS  03.2
01AD:  GOTO   1C1
01AE:  MOVF   77,W
01AF:  SUBWF  7A,W
01B0:  BTFSS  03.2
01B1:  GOTO   1C1
01B2:  DECF   04,F
01B3:  CLRF   00
01B4:  INCF   04,F
01B5:  CLRF   00
01B6:  INCF   04,F
01B7:  BTFSC  79.7
01B8:  GOTO   1C1
01B9:  INCF   04,F
01BA:  MOVF   00,W
01BB:  MOVWF  0A
01BC:  DECF   04,F
01BD:  MOVF   00,W
01BE:  MOVWF  02
01BF:  BCF    03.5
01C0:  BCF    03.6
01C1:  INCF   20,F
01C2:  MOVLW  02
01C3:  SUBWF  20,W
01C4:  BTFSS  03.2
01C5:  GOTO   18D
01C6:  CLRF   20
01C7:  BTFSS  0C.1
01C8:  GOTO   1CB
01C9:  BSF    03.5
01CA:  GOTO   18B
01CB:  GOTO   1C7
01CC:  MOVLW  FF
01CD:  MOVWF  20
....................  
.................... } 
01CE:  SLEEP

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