Subversion Repositories svnkaklik

Rev

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

CCS PCW C Compiler, Version 3.110, 15448

               Filename: d:\@kaklik\programy\pic_c\prenos\letadlo\prijimac\ostra_bez_ladicich_impulsu\main.LST

               ROM used: 309 (30%)
                         Largest free fragment is 715
               RAM used: 18 (26%) at main() level
                         20 (29%) worst case
               Stack:    3 worst case (1 in main + 2 for interrupts)

*
0000:  MOVLW  00
0001:  MOVWF  0A
0002:  GOTO   083
0003:  NOP
0004:  BTFSC  03.5
0005:  GOTO   00A
0006:  MOVWF  0E
0007:  SWAPF  03,W
0008:  MOVWF  0F
0009:  GOTO   00F
000A:  BCF    03.5
000B:  MOVWF  0E
000C:  SWAPF  03,W
000D:  MOVWF  0F
000E:  BSF    0F.1
000F:  MOVF   0A,W
0010:  MOVWF  13
0011:  CLRF   0A
0012:  BCF    03.7
0013:  SWAPF  0E,F
0014:  MOVF   04,W
0015:  MOVWF  10
0016:  MOVF   0C,W
0017:  MOVWF  11
0018:  MOVF   0D,W
0019:  MOVWF  12
001A:  BCF    03.5
001B:  BTFSS  0B.5
001C:  GOTO   01F
001D:  BTFSC  0B.2
001E:  GOTO   043
001F:  MOVF   10,W
0020:  MOVWF  04
0021:  MOVF   11,W
0022:  MOVWF  0C
0023:  MOVF   12,W
0024:  MOVWF  0D
0025:  MOVF   13,W
0026:  MOVWF  0A
0027:  SWAPF  0F,W
0028:  MOVWF  03
0029:  BCF    03.5
002A:  SWAPF  0E,W
002B:  BTFSC  0F.1
002C:  BSF    03.5
002D:  RETFIE
....................  // Prijimac  
.................... #include "main.h" 
....................  #include <16F84.h> 
....................  //////// Standard Header file for the PIC16F84 device ////////////////  
.................... #device PIC16F84  
.................... #list  
....................  
.................... #use delay(clock=4000000)  
002E:  MOVLW  1F
002F:  MOVWF  04
0030:  MOVF   00,W
0031:  BTFSC  03.2
0032:  GOTO   042
0033:  MOVLW  01
0034:  MOVWF  0D
0035:  CLRF   0C
0036:  DECFSZ 0C,F
0037:  GOTO   036
0038:  DECFSZ 0D,F
0039:  GOTO   035
003A:  MOVLW  4A
003B:  MOVWF  0C
003C:  DECFSZ 0C,F
003D:  GOTO   03C
003E:  NOP
003F:  NOP
0040:  DECFSZ 00,F
0041:  GOTO   033
0042:  RETLW  00
.................... #fuses XT,PUT,NOWDT  
....................   
....................  
.................... #include "..\..\common.h" 
....................  #DEFINE  OSA_X          1           // adresy os  
.................... #DEFINE  OSA_Y          2  
.................... #DEFINE  OSA_Z          3  
.................... #DEFINE  OSA_W          4  
.................... #DEFINE  TLs            5  
.................... #DEFINE  Trim           6           // ovladani prijimace  
....................   
.................... #DEFINE  IMPULS         250         // sirka impulsu  
.................... #DEFINE  SYNC           15          // delka uvodniho ticha v IMPULS/4  
....................  
....................   
.................... #DEFINE  PRIJIMAC       PIN_A3      // pin na ktery je pripojen prijimac  
.................... #DEFINE  SERVO_X        PIN_A2      // piny na ktere jsou pripojena serva  
.................... #DEFINE  SERVO_Y        PIN_B0  
.................... #DEFINE  DILEK          20           // jeden krok serva v mikrosekundach  
....................   
.................... #bit  T0IF = 0xB.2   // int. flag od Timer0  
....................   
.................... static int8   x = 16;     // poloha serv  
.................... static int8   y = 16;  
.................... int8  trim_x = 2;  
.................... int8  trim_y = 2;  
....................   
.................... boolean flag;      // priznak, ze doslo k preruseni prijmu ovladanim serv  
....................   
.................... #int_TIMER0  
.................... TIMER0_isr()  
.................... {  
....................    int8 n;  
....................   
....................    flag = true;   // doslo k preruseni prijmu  
0043:  BSF    18.0
.................... //   x = 15;  
.................... //   y = 15;  
....................   
....................    output_high(SERVO_X);   // uvodni impuls 1ms  
0044:  BSF    03.5
0045:  BCF    05.2
0046:  BCF    03.5
0047:  BSF    05.2
....................    delay_ms(1);  
0048:  MOVLW  01
0049:  MOVWF  1F
004A:  CALL   02E
....................    for (n=trim_x; n>0; n--);  
004B:  MOVF   16,W
004C:  MOVWF  1E
004D:  MOVF   1E,F
004E:  BTFSC  03.2
004F:  GOTO   052
0050:  DECF   1E,F
0051:  GOTO   04D
....................    for (n=x; n>0; n--) Delay_us(DILEK);  
0052:  MOVF   14,W
0053:  MOVWF  1E
0054:  MOVF   1E,F
0055:  BTFSC  03.2
0056:  GOTO   05E
0057:  MOVLW  06
0058:  MOVWF  0C
0059:  DECFSZ 0C,F
005A:  GOTO   059
005B:  NOP
005C:  DECF   1E,F
005D:  GOTO   054
....................    output_low(SERVO_X);  
005E:  BSF    03.5
005F:  BCF    05.2
0060:  BCF    03.5
0061:  BCF    05.2
....................   
....................    output_high(SERVO_Y);  
0062:  BSF    03.5
0063:  BCF    06.0
0064:  BCF    03.5
0065:  BSF    06.0
....................    delay_ms(1);  
0066:  MOVLW  01
0067:  MOVWF  1F
0068:  CALL   02E
....................    for (n=trim_y; n>0; n--);  
0069:  MOVF   17,W
006A:  MOVWF  1E
006B:  MOVF   1E,F
006C:  BTFSC  03.2
006D:  GOTO   070
006E:  DECF   1E,F
006F:  GOTO   06B
....................    for (n=y; n>0; n--) Delay_us(DILEK);  
0070:  MOVF   15,W
0071:  MOVWF  1E
0072:  MOVF   1E,F
0073:  BTFSC  03.2
0074:  GOTO   07C
0075:  MOVLW  06
0076:  MOVWF  0C
0077:  DECFSZ 0C,F
0078:  GOTO   077
0079:  NOP
007A:  DECF   1E,F
007B:  GOTO   072
....................    output_low(SERVO_Y);  
007C:  BSF    03.5
007D:  BCF    06.0
007E:  BCF    03.5
007F:  BCF    06.0
0080:  BCF    0B.2
0081:  BCF    0A.3
0082:  GOTO   01F
.................... }  
....................   
.................... // output_high(PIN_B1);   // debug pin  
....................   
.................... void main()  
.................... {  
....................    int i;  
....................    int8 osa, data, check, suma;  
0083:  CLRF   04
0084:  MOVLW  1F
0085:  ANDWF  03,F
0086:  MOVLW  10
0087:  MOVWF  14
0088:  MOVWF  15
0089:  MOVLW  02
008A:  MOVWF  16
008B:  MOVWF  17
....................   
....................    setup_counters(RTCC_INTERNAL,RTCC_DIV_64);   // Preruseni po 16,3ms  
008C:  MOVLW  05
008D:  MOVWF  0C
008E:  BTFSS  0C.3
008F:  GOTO   098
0090:  MOVLW  07
0091:  CLRF   01
0092:  MOVLW  81
0093:  MOVWF  04
0094:  MOVF   00,W
0095:  ANDLW  C0
0096:  IORLW  0F
0097:  MOVWF  00
0098:  CLRWDT
0099:  MOVLW  81
009A:  MOVWF  04
009B:  MOVF   00,W
009C:  ANDLW  C0
009D:  IORWF  0C,W
009E:  MOVWF  00
....................    enable_interrupts(INT_TIMER0);  
009F:  BSF    0B.5
....................    enable_interrupts(global);  
00A0:  BSF    0B.7
....................   
.................... loop:  
....................    flag = false;  
00A1:  BCF    18.0
....................   
....................    // Cekej na uvodni ticho  
....................    for (i=SYNC; i>0; i--)  
00A2:  MOVLW  0F
00A3:  MOVWF  19
00A4:  MOVF   19,F
00A5:  BTFSC  03.2
00A6:  GOTO   0B8
....................    {  
....................       delay_us(IMPULS/4);  
00A7:  MOVLW  14
00A8:  MOVWF  0C
00A9:  DECFSZ 0C,F
00AA:  GOTO   0A9
00AB:  NOP
....................       if (flag) goto loop;  
00AC:  BTFSS  18.0
00AD:  GOTO   0AF
00AE:  GOTO   0A1
....................       if (!input(PRIJIMAC)) i=SYNC;  
00AF:  BSF    03.5
00B0:  BSF    05.3
00B1:  BCF    03.5
00B2:  BTFSC  05.3
00B3:  GOTO   0B6
00B4:  MOVLW  0F
00B5:  MOVWF  19
....................    }  
00B6:  DECF   19,F
00B7:  GOTO   0A4
....................   
....................    // Cekej na startovaci 1  
....................    while (input(PRIJIMAC)) if (flag) goto loop;  
00B8:  BSF    03.5
00B9:  BSF    05.3
00BA:  BCF    03.5
00BB:  BTFSS  05.3
00BC:  GOTO   0C1
00BD:  BTFSS  18.0
00BE:  GOTO   0C0
00BF:  GOTO   0A1
00C0:  GOTO   0B8
....................   
....................    if (flag) goto loop;  
00C1:  BTFSS  18.0
00C2:  GOTO   0C4
00C3:  GOTO   0A1
....................   
....................    // Posun na cteni prvniho datoveho bitu  
....................    delay_us(2*IMPULS+2*IMPULS/3);  
00C4:  MOVLW  DD
00C5:  MOVWF  0C
00C6:  DECFSZ 0C,F
00C7:  GOTO   0C6
00C8:  NOP
00C9:  NOP
....................   
....................    // Cteme bity  
....................    for (i=8; i>0; i--)  
00CA:  MOVLW  08
00CB:  MOVWF  19
00CC:  MOVF   19,F
00CD:  BTFSC  03.2
00CE:  GOTO   0E9
....................    {  
....................       data <<= 1;  
00CF:  BCF    03.0
00D0:  RLF    1B,F
....................       if (input(PRIJIMAC)) data |= 1;  
00D1:  BSF    03.5
00D2:  BSF    05.3
00D3:  BCF    03.5
00D4:  BTFSS  05.3
00D5:  GOTO   0D7
00D6:  BSF    1B.0
....................       if (flag) goto loop;  
00D7:  BTFSS  18.0
00D8:  GOTO   0DA
00D9:  GOTO   0A1
.................... output_high(PIN_B1);   // debug pin  
00DA:  BSF    03.5
00DB:  BCF    06.1
00DC:  BCF    03.5
00DD:  BSF    06.1
....................       delay_us(2*IMPULS+15);  
00DE:  MOVLW  AB
00DF:  MOVWF  0C
00E0:  DECFSZ 0C,F
00E1:  GOTO   0E0
00E2:  NOP
.................... output_low(PIN_B1);   // debug pin  
00E3:  BSF    03.5
00E4:  BCF    06.1
00E5:  BCF    03.5
00E6:  BCF    06.1
....................    }  
00E7:  DECF   19,F
00E8:  GOTO   0CC
....................   
....................    // Cteme checksum  
....................    check = 0;  
00E9:  CLRF   1C
....................    for (i=4; i>0; i--)  
00EA:  MOVLW  04
00EB:  MOVWF  19
00EC:  MOVF   19,F
00ED:  BTFSC  03.2
00EE:  GOTO   109
....................    {  
....................       check <<= 1;  
00EF:  BCF    03.0
00F0:  RLF    1C,F
....................       if (input(PRIJIMAC)) check |= 1;  
00F1:  BSF    03.5
00F2:  BSF    05.3
00F3:  BCF    03.5
00F4:  BTFSS  05.3
00F5:  GOTO   0F7
00F6:  BSF    1C.0
....................       if (flag) goto loop;  
00F7:  BTFSS  18.0
00F8:  GOTO   0FA
00F9:  GOTO   0A1
.................... output_high(PIN_B1);   // debug pin  
00FA:  BSF    03.5
00FB:  BCF    06.1
00FC:  BCF    03.5
00FD:  BSF    06.1
....................       delay_us(2*IMPULS+15);  
00FE:  MOVLW  AB
00FF:  MOVWF  0C
0100:  DECFSZ 0C,F
0101:  GOTO   100
0102:  NOP
.................... output_low(PIN_B1);   // debug pin  
0103:  BSF    03.5
0104:  BCF    06.1
0105:  BCF    03.5
0106:  BCF    06.1
....................    }  
0107:  DECF   19,F
0108:  GOTO   0EC
....................   
....................    swap(data);          // kontrola kontrolniho souctu  
0109:  SWAPF  1B,F
....................    suma = data & 0xF;     
010A:  MOVF   1B,W
010B:  ANDLW  0F
010C:  MOVWF  1D
....................    swap(data);  
010D:  SWAPF  1B,F
....................    suma += data & 0xF;  
010E:  MOVF   1B,W
010F:  ANDLW  0F
0110:  ADDWF  1D,F
....................    suma++;  
0111:  INCF   1D,F
....................    suma &= 0xF;  
0112:  MOVLW  0F
0113:  ANDWF  1D,F
....................    if (suma != check) goto loop;  
0114:  MOVF   1C,W
0115:  SUBWF  1D,W
0116:  BTFSC  03.2
0117:  GOTO   119
0118:  GOTO   0A1
....................   
....................    osa = data >> 5;  // extrahuj z ramce cislo osy a hodnotu  
0119:  SWAPF  1B,W
011A:  MOVWF  1A
011B:  RRF    1A,F
011C:  MOVLW  07
011D:  ANDWF  1A,F
....................    data &= 0x1F;  
011E:  MOVLW  1F
011F:  ANDWF  1B,F
....................    switch(osa)  
0120:  MOVLW  01
0121:  SUBWF  1A,W
0122:  ADDLW  FE
0123:  BTFSC  03.0
0124:  GOTO   12D
0125:  ADDLW  02
0126:  GOTO   12F
....................    {  
....................       case OSA_X:  
....................          x=data;  
0127:  MOVF   1B,W
0128:  MOVWF  14
....................         break;  
0129:  GOTO   12D
....................       case OSA_y:  
....................          y=data;  
012A:  MOVF   1B,W
012B:  MOVWF  15
....................         break;  
012C:  GOTO   12D
....................    }  
*
012F:  BSF    0A.0
0130:  BCF    0A.1
0131:  BCF    0A.2
0132:  ADDWF  02,F
0133:  GOTO   127
0134:  GOTO   12A
....................   
....................    goto loop;  
*
012D:  GOTO   0A1
.................... }  
....................  
012E:  SLEEP