Subversion Repositories svnkaklik

Rev

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

CCS PCM C Compiler, Version 3.245, 27853               22-I-07 23:13

               Filename: C:\PIC\laserus\laser.lst

               ROM used: 326 words (8%)
                         Largest free fragment is 2048
               RAM used: 19 (11%) at main() level
                         26 (15%) worst case
               Stack:    2 worst case (1 in main + 1 for interrupts)

*
0000:  MOVLW  00
0001:  MOVWF  0A
0002:  GOTO   0E7
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:  BTFSS  0B.4
001D:  GOTO   020
001E:  BTFSC  0B.1
001F:  GOTO   033
0020:  MOVF   22,W
0021:  MOVWF  04
0022:  MOVF   23,W
0023:  MOVWF  77
0024:  MOVF   24,W
0025:  MOVWF  78
0026:  MOVF   25,W
0027:  MOVWF  79
0028:  MOVF   26,W
0029:  MOVWF  7A
002A:  MOVF   27,W
002B:  MOVWF  7B
002C:  MOVF   28,W
002D:  MOVWF  0A
002E:  SWAPF  21,W
002F:  MOVWF  03
0030:  SWAPF  7F,F
0031:  SWAPF  7F,W
0032:  RETFIE
0033:  BCF    0A.3
0034:  GOTO   035
.................... #include "laser.h" 
.................... #include <16F88.h> 
.................... //////// Standard Header file for the PIC16F88 device //////////////// 
.................... #device PIC16F88 
.................... #list 
....................  
.................... #device adc=8 
....................  
.................... #FUSES NOWDT                       //No Watch Dog Timer 
.................... #FUSES XT                          //Crystal osc <= 4mhz 
.................... #FUSES NOPUT                       //No Power Up Timer 
.................... #FUSES MCLR                        //Master Clear pin enabled 
.................... #FUSES NOBROWNOUT                  //No brownout reset 
.................... #FUSES NOLVP                       //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O 
.................... #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 disabled 
.................... #FUSES NOIESO                      //Internal External Switch Over mode disabled 
....................  
.................... #use delay(clock=4000000) 
*
00D2:  MOVLW  2B
00D3:  MOVWF  04
00D4:  MOVF   00,W
00D5:  BTFSC  03.2
00D6:  GOTO   0E6
00D7:  MOVLW  01
00D8:  MOVWF  78
00D9:  CLRF   77
00DA:  DECFSZ 77,F
00DB:  GOTO   0DA
00DC:  DECFSZ 78,F
00DD:  GOTO   0D9
00DE:  MOVLW  4A
00DF:  MOVWF  77
00E0:  DECFSZ 77,F
00E1:  GOTO   0E0
00E2:  NOP
00E3:  NOP
00E4:  DECFSZ 00,F
00E5:  GOTO   0D7
00E6:  RETLW  00
....................  
....................  
.................... #include "16F88_Reg.H" 
.................... // Komplete definition of all Special Feature Registers 
.................... // of PIC16F87 and PIC16F88 
.................... // (c)miho 2005 
....................  
.................... #list 
....................  
....................  
.................... #define SERVO PIN_B5    // Vystup pro rizeni serva 
.................... #define LASER PIN_B4    // Vstup pro cteni laseru 
....................  
.................... // kroutitka 
.................... #define  CERVENA  0  // AN0 
.................... #define  CERNA    1  // AN1 
.................... //#define  ZELENA   3  // AN3 
.................... //#define  MODRA    4  // AN4 
....................  
.................... //#define OFFSET 100       // Predni kolecko vprostred pri care vprostred 
.................... //#define HYSTERESE 3      // Rozdil mezi behem tam a zpet 
....................  
.................... boolean edge; 
.................... int8 uhel; 
....................  
.................... #int_EXT 
.................... EXT_isr() 
.................... { 
....................    int n, t1, t2, t; 
....................  
....................    set_timer0(0);          // Vynulovani casovace pro 2ms 
*
0035:  CLRF   01
....................    output_high(SERVO); 
0036:  BSF    03.5
0037:  BCF    06.5
0038:  BCF    03.5
0039:  BSF    06.5
....................    while(get_timer0()<(1000/256));    // Ceka 1ms 
003A:  MOVF   01,W
003B:  SUBLW  02
003C:  BTFSC  03.0
003D:  GOTO   03A
....................    for(n=uhel; n>0; n--) delay_us(3); // Sirka impulzu podle uhlu 
003E:  MOVF   2A,W
003F:  MOVWF  2E
0040:  MOVF   2E,F
0041:  BTFSC  03.2
0042:  GOTO   048
0043:  NOP
0044:  NOP
0045:  NOP
0046:  DECF   2E,F
0047:  GOTO   040
....................    output_low(SERVO); 
0048:  BSF    03.5
0049:  BCF    06.5
004A:  BCF    03.5
004B:  BCF    06.5
....................    while(get_timer0()<(3000/256)); // Ceka do 3ms, nez zacne scanovat 
004C:  MOVF   01,W
004D:  SUBLW  0A
004E:  BTFSC  03.0
004F:  GOTO   04C
....................  
....................    set_timer0(0);          // Vynulovani casovace pro zjisteni polohy cary 
0050:  CLRF   01
....................    if(edge)                // Zrcatko prejizdelo tam nebo zpet? 
0051:  BTFSS  29.0
0052:  GOTO   092
....................    { 
....................      edge=false; 
0053:  BCF    29.0
....................      ext_int_edge(H_TO_L);    // Pristi inerrupt bude od opacne hrany 
0054:  BSF    03.5
0055:  BCF    01.6
....................      INT0IF_1=0;              // Povoleni dalsiho preruseni 
0056:  BCF    0B.1
....................      enable_interrupts(INT_EXT); 
0057:  BCF    03.5
0058:  BSF    0B.4
....................      enable_interrupts(GLOBAL); 
0059:  MOVLW  C0
005A:  IORWF  0B,F
.................... //     do 
....................      { 
....................        while(0==input(LASER));  // Ceka na detekci cary 
005B:  BSF    03.5
005C:  BSF    06.4
005D:  MOVLW  00
005E:  BCF    03.5
005F:  BTFSC  06.4
0060:  MOVLW  01
0061:  XORLW  00
0062:  BTFSC  03.2
0063:  GOTO   05B
.................... //   output_high(SERVO); 
....................        t1=get_timer0();         // Poznamena cas nabezne hrany 
0064:  MOVF   01,W
0065:  MOVWF  2F
....................        while(1==input(LASER));  // Ceka az zkonci cara 
0066:  BSF    03.5
0067:  BSF    06.4
0068:  MOVLW  00
0069:  BCF    03.5
006A:  BTFSC  06.4
006B:  MOVLW  01
006C:  SUBLW  01
006D:  BTFSC  03.2
006E:  GOTO   066
.................... //   output_low(SERVO); 
....................        t2=get_timer0();         // Poznamena cas sestupne hrany 
006F:  MOVF   01,W
0070:  MOVWF  30
....................        t=t2-t1; 
0071:  MOVF   2F,W
0072:  SUBWF  30,W
0073:  MOVWF  31
....................      } //while((t<5) || (t>7)); // Cara je detekovana, kdyz trva mezi xx ms 
....................      if ((t>3) && (t<8)) uhel=(160-(read_adc()>>2))-t1; 
0074:  MOVF   31,W
0075:  SUBLW  03
0076:  BTFSC  03.0
0077:  GOTO   08B
0078:  MOVF   31,W
0079:  SUBLW  07
007A:  BTFSS  03.0
007B:  GOTO   08B
007C:  BSF    1F.2
007D:  BTFSC  1F.2
007E:  GOTO   07D
007F:  MOVF   1E,W
0080:  MOVWF  77
0081:  RRF    77,F
0082:  RRF    77,F
0083:  MOVLW  3F
0084:  ANDWF  77,F
0085:  MOVF   77,W
0086:  SUBLW  A0
0087:  MOVWF  78
0088:  MOVF   2F,W
0089:  SUBWF  78,W
008A:  MOVWF  2A
....................      set_adc_channel(1); 
008B:  MOVLW  08
008C:  MOVWF  78
008D:  MOVF   1F,W
008E:  ANDLW  C7
008F:  IORWF  78,W
0090:  MOVWF  1F
....................    } 
....................    else 
0091:  GOTO   0CE
....................    { 
....................      edge=true; 
0092:  BSF    29.0
....................      ext_int_edge(L_TO_H); 
0093:  BSF    03.5
0094:  BSF    01.6
....................      INT0IF_1=0;              // Povoleni dalsiho preruseni 
0095:  BCF    0B.1
....................      enable_interrupts(INT_EXT); 
0096:  BCF    03.5
0097:  BSF    0B.4
....................      enable_interrupts(GLOBAL); 
0098:  MOVLW  C0
0099:  IORWF  0B,F
.................... //     do 
....................      { 
....................        while(0==input(LASER));  // Ceka na detekci cary 
009A:  BSF    03.5
009B:  BSF    06.4
009C:  MOVLW  00
009D:  BCF    03.5
009E:  BTFSC  06.4
009F:  MOVLW  01
00A0:  XORLW  00
00A1:  BTFSC  03.2
00A2:  GOTO   09A
....................        t1=get_timer0();         // Poznamena cas nabezne hrany 
00A3:  MOVF   01,W
00A4:  MOVWF  2F
....................        while(1==input(LASER));  // Ceka az zkonci cara 
00A5:  BSF    03.5
00A6:  BSF    06.4
00A7:  MOVLW  00
00A8:  BCF    03.5
00A9:  BTFSC  06.4
00AA:  MOVLW  01
00AB:  SUBLW  01
00AC:  BTFSC  03.2
00AD:  GOTO   0A5
....................        t2=get_timer0();         // Poznamena cas sestupne hrany 
00AE:  MOVF   01,W
00AF:  MOVWF  30
....................        t=t2-t1; 
00B0:  MOVF   2F,W
00B1:  SUBWF  30,W
00B2:  MOVWF  31
....................      } //while((t<5) || (t>7)); // Cara je detekovana, kdyz trva mezi xx ms 
....................      if ((t>3) && (t<8)) uhel=((read_adc()>>2)+32)+t1; 
00B3:  MOVF   31,W
00B4:  SUBLW  03
00B5:  BTFSC  03.0
00B6:  GOTO   0C8
00B7:  MOVF   31,W
00B8:  SUBLW  07
00B9:  BTFSS  03.0
00BA:  GOTO   0C8
00BB:  BSF    1F.2
00BC:  BTFSC  1F.2
00BD:  GOTO   0BC
00BE:  MOVF   1E,W
00BF:  MOVWF  77
00C0:  RRF    77,F
00C1:  RRF    77,F
00C2:  MOVLW  3F
00C3:  ANDWF  77,F
00C4:  MOVF   77,W
00C5:  ADDLW  20
00C6:  ADDWF  2F,W
00C7:  MOVWF  2A
....................      set_adc_channel(0); 
00C8:  MOVLW  00
00C9:  MOVWF  78
00CA:  MOVF   1F,W
00CB:  ANDLW  C7
00CC:  IORWF  78,W
00CD:  MOVWF  1F
....................    } 
....................    while(true); 
00CE:  GOTO   0CE
.................... } 
....................  
....................  
....................  
00CF:  BCF    0B.1
00D0:  BCF    0A.3
00D1:  GOTO   020
.................... void main() 
.................... { 
*
00E7:  CLRF   04
00E8:  MOVLW  1F
00E9:  ANDWF  03,F
00EA:  BSF    03.5
00EB:  BCF    1F.4
00EC:  BCF    1F.5
00ED:  MOVF   1B,W
00EE:  ANDLW  80
00EF:  MOVWF  1B
00F0:  MOVLW  07
00F1:  MOVWF  1C
....................    setup_adc_ports(sAN0|sAN1|VSS_VDD); // AD pro kroutitka 
00F2:  BCF    1F.4
00F3:  BCF    1F.5
00F4:  MOVF   1B,W
00F5:  ANDLW  80
00F6:  IORLW  03
00F7:  MOVWF  1B
....................    setup_adc(ADC_CLOCK_INTERNAL); 
00F8:  BCF    1F.6
00F9:  BCF    03.5
00FA:  BSF    1F.6
00FB:  BSF    1F.7
00FC:  BSF    03.5
00FD:  BCF    1F.7
00FE:  BCF    03.5
00FF:  BSF    1F.0
....................    setup_spi(FALSE); 
0100:  BCF    14.5
0101:  BSF    03.5
0102:  BCF    06.2
0103:  BSF    06.1
0104:  BCF    06.4
0105:  MOVLW  00
0106:  BCF    03.5
0107:  MOVWF  14
0108:  BSF    03.5
0109:  MOVWF  14
....................    setup_timer_0(RTCC_INTERNAL|RTCC_DIV_256); 
010A:  MOVF   01,W
010B:  ANDLW  C0
010C:  IORLW  07
010D:  MOVWF  01
....................    setup_timer_1(T1_DISABLED); 
010E:  BCF    03.5
010F:  CLRF   10
....................    setup_timer_2(T2_DISABLED,0,1); 
0110:  MOVLW  00
0111:  MOVWF  78
0112:  MOVWF  12
0113:  MOVLW  00
0114:  BSF    03.5
0115:  MOVWF  12
....................    setup_comparator(NC_NC_NC_NC); 
0116:  MOVLW  07
0117:  MOVWF  1C
0118:  MOVF   05,W
0119:  MOVLW  03
011A:  MOVWF  77
011B:  DECFSZ 77,F
011C:  GOTO   11B
011D:  MOVF   1C,W
011E:  BCF    03.5
011F:  BCF    0D.6
....................    setup_vref(FALSE); 
0120:  BSF    03.5
0121:  CLRF   1D
....................    setup_oscillator(False); 
0122:  CLRF   0F
0123:  MOVF   0F,W
....................  
....................    delay_ms(100); 
0124:  MOVLW  64
0125:  BCF    03.5
0126:  MOVWF  2B
0127:  CALL   0D2
....................    set_adc_channel(0); 
0128:  MOVLW  00
0129:  MOVWF  78
012A:  MOVF   1F,W
012B:  ANDLW  C7
012C:  IORWF  78,W
012D:  MOVWF  1F
....................    Delay_ms(1); 
012E:  MOVLW  01
012F:  MOVWF  2B
0130:  CALL   0D2
....................  
....................    ext_int_edge(L_TO_H); 
0131:  BSF    03.5
0132:  BSF    01.6
....................    edge=true; 
0133:  BCF    03.5
0134:  BSF    29.0
....................    uhel=((read_adc()>>2)+32)+30;; 
0135:  BSF    1F.2
0136:  BTFSC  1F.2
0137:  GOTO   136
0138:  MOVF   1E,W
0139:  MOVWF  77
013A:  RRF    77,F
013B:  RRF    77,F
013C:  MOVLW  3F
013D:  ANDWF  77,F
013E:  MOVF   77,W
013F:  ADDLW  20
0140:  ADDLW  1E
0141:  MOVWF  2A
....................    enable_interrupts(INT_EXT); 
0142:  BSF    0B.4
....................    enable_interrupts(GLOBAL); 
0143:  MOVLW  C0
0144:  IORWF  0B,F
.................... } 
0145:  SLEEP

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