Subversion Repositories svnkaklik

Rev

Rev 10 | Blame | Last modification | View Log | Download

CCS PCM C Compiler, Version 3.245, 27853               17-IX-06 22:12

               Filename: D:\KAKL\roboti\solarni\2006\scamnum\menic.lst

               ROM used: 836 words (20%)
                         Largest free fragment is 2048
               RAM used: 87 (50%) at main() level
                         94 (54%) worst case
               Stack:    4 worst case (3 in main + 1 for interrupts)

*
0000:  MOVLW  00
0001:  MOVWF  0A
0002:  GOTO   1C3
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.3
001F:  GOTO   022
0020:  BTFSC  0C.3
0021:  GOTO   035
0022:  MOVF   22,W
0023:  MOVWF  04
0024:  MOVF   23,W
0025:  MOVWF  77
0026:  MOVF   24,W
0027:  MOVWF  78
0028:  MOVF   25,W
0029:  MOVWF  79
002A:  MOVF   26,W
002B:  MOVWF  7A
002C:  MOVF   27,W
002D:  MOVWF  7B
002E:  MOVF   28,W
002F:  MOVWF  0A
0030:  SWAPF  21,W
0031:  MOVWF  03
0032:  SWAPF  7F,F
0033:  SWAPF  7F,W
0034:  RETFIE
0035:  BCF    0A.3
0036:  GOTO   037
.................... // ************************************* 
.................... // * Scamnum Specularis ** 20. 9. 2006 * 
.................... // ************************************* 
....................  
.................... #include ".\menic.h" 
.................... #include <16F88.h> 
.................... //////// Standard Header file for the PIC16F88 device //////////////// 
.................... #device PIC16F88 
.................... #list 
....................  
....................  
.................... #device adc=8 
....................  
.................... #fuses   NOWDT,INTRC_IO, NOPUT, MCLR, NOBROWNOUT, NOLVP, NOCPD, \ 
....................          NOWRT, DEBUG, NOPROTECT, NOFCMEN, NOIESO, CCPB3 
....................  
.................... #use delay(clock=3900000,RESTART_WDT) 
*
003C:  MOVLW  71
003D:  MOVWF  04
003E:  MOVF   00,W
003F:  BTFSC  03.2
0040:  GOTO   051
0041:  MOVLW  01
0042:  MOVWF  78
0043:  MOVLW  BF
0044:  MOVWF  77
0045:  CLRWDT
0046:  DECFSZ 77,F
0047:  GOTO   045
0048:  DECFSZ 78,F
0049:  GOTO   043
004A:  MOVLW  42
004B:  MOVWF  77
004C:  DECFSZ 77,F
004D:  GOTO   04C
004E:  CLRWDT
004F:  DECFSZ 00,F
0050:  GOTO   041
0051:  RETLW  00
*
01B0:  MOVLW  12
01B1:  SUBWF  72,F
01B2:  BTFSS  03.0
01B3:  GOTO   1C2
01B4:  MOVLW  72
01B5:  MOVWF  04
01B6:  MOVLW  FC
01B7:  ANDWF  00,F
01B8:  BCF    03.0
01B9:  RRF    00,F
01BA:  RRF    00,F
01BB:  MOVF   00,W
01BC:  BTFSC  03.2
01BD:  GOTO   1C2
01BE:  GOTO   1C0
01BF:  CLRWDT
01C0:  DECFSZ 00,F
01C1:  GOTO   1BF
01C2:  RETLW  00
....................  
....................  
....................  
.................... #define  TXo PIN_B5           // To the transmitter modulator 
.................... #include ".\AX25.c"           // Podprogram pro prenos telemetrie 
.................... //#define  PTT PIN_A2                 // PTT control 
.................... //#define  TXo PIN_C0                 // To the transmitter modulator 
.................... //#define  PERIODAH delay_us(218)     // Halfperiod H 222;78/1200     500;430/500 
.................... //#define  TAILH delay_us(74) 
.................... //#define  PERIODAL delay_us(408)     // Halfperiod L 412;345/1200    1000;880/500 
.................... //#define  TAILL delay_us(341) 
.................... #define  PERIODAH delay_us(222)     // Halfperiod H 222;78/1200     500;430/500 
.................... #define  TAILH delay_us(78) 
.................... #define  PERIODAL delay_us(412)     // Halfperiod L 412;345/1200    1000;880/500 
.................... #define  TAILL delay_us(345) 
.................... #byte    STATUS = 3                 // CPUs status register 
....................  
.................... byte SendData[16] = {'A'<<1, 'L'<<1, 'L'<<1, ' '<<1, ' '<<1, ' '<<1,  0x60, 
....................                      'C'<<1, 'Z'<<1, '0'<<1, 'R'<<1, 'R'<<1, 'R'<<1, 0x61, 
....................                      0x03, 0xF0}; 
*
01CE:  MOVLW  82
01CF:  BCF    03.5
01D0:  MOVWF  29
01D1:  MOVLW  98
01D2:  MOVWF  2A
01D3:  MOVWF  2B
01D4:  MOVLW  40
01D5:  MOVWF  2C
01D6:  MOVWF  2D
01D7:  MOVWF  2E
01D8:  MOVLW  60
01D9:  MOVWF  2F
01DA:  MOVLW  86
01DB:  MOVWF  30
01DC:  MOVLW  B4
01DD:  MOVWF  31
01DE:  MOVLW  60
01DF:  MOVWF  32
01E0:  MOVLW  A4
01E1:  MOVWF  33
01E2:  MOVWF  34
01E3:  MOVWF  35
01E4:  MOVLW  61
01E5:  MOVWF  36
01E6:  MOVLW  03
01E7:  MOVWF  37
01E8:  MOVLW  F0
01E9:  MOVWF  38
....................  
.................... boolean bit; 
.................... int fcslo, fcshi;    // variabloes for calculating FCS (CRC) 
.................... int stuff;           // stuff counter for extra 0 
.................... int flag_flag;       // if it is sending flag (7E) 
.................... int fcs_flag;        // if it is sending Frame Check Sequence 
.................... int i;               // for for 
....................  
.................... void flipout()       //flips the state of output pin a_1 
.................... { 
....................    stuff = 0;        //since this is a 0, reset the stuff counter 
*
00DD:  CLRF   3C
....................    if (bit) 
00DE:  BTFSS  39.0
00DF:  GOTO   0E2
....................    { 
....................      bit=FALSE;      //if the state of the pin was low, make it high. 
00E0:  BCF    39.0
....................    } 
....................    else 
00E1:  GOTO   0E3
....................    { 
....................      bit=TRUE;                //if the state of the pin was high make it low 
00E2:  BSF    39.0
....................    } 
.................... } 
00E3:  RETLW  00
....................  
.................... void fcsbit(byte tbyte) 
.................... { 
.................... #asm 
....................    BCF    STATUS,0 
*
013F:  BCF    03.0
....................    RRF    fcshi,F             // rotates the entire 16 bits 
0140:  RRF    3B,F
....................    RRF    fcslo,F                        // to the right 
0141:  RRF    3A,F
.................... #endasm 
....................    if (((STATUS & 0x01)^(tbyte)) ==0x01) 
0142:  MOVF   03,W
0143:  ANDLW  01
0144:  XORWF  75,W
0145:  SUBLW  01
0146:  BTFSS  03.2
0147:  GOTO   14C
....................    { 
....................          fcshi = fcshi^0x84; 
0148:  MOVLW  84
0149:  XORWF  3B,F
....................          fcslo = fcslo^0x08; 
014A:  MOVLW  08
014B:  XORWF  3A,F
....................    } 
.................... } 
....................  
.................... void SendBit () 
.................... { 
....................    if (bit) 
*
00E4:  BTFSS  39.0
00E5:  GOTO   110
....................    { 
....................       output_low(TXo); 
00E6:  BSF    03.5
00E7:  BCF    06.5
00E8:  BCF    03.5
00E9:  BCF    06.5
....................       PERIODAH; 
00EA:  CLRWDT
00EB:  MOVLW  47
00EC:  MOVWF  77
00ED:  DECFSZ 77,F
00EE:  GOTO   0ED
00EF:  NOP
....................       output_high(TXo); 
00F0:  BSF    03.5
00F1:  BCF    06.5
00F2:  BCF    03.5
00F3:  BSF    06.5
....................       PERIODAH; 
00F4:  CLRWDT
00F5:  MOVLW  47
00F6:  MOVWF  77
00F7:  DECFSZ 77,F
00F8:  GOTO   0F7
00F9:  NOP
....................       output_low(TXo); 
00FA:  BSF    03.5
00FB:  BCF    06.5
00FC:  BCF    03.5
00FD:  BCF    06.5
....................       PERIODAH; 
00FE:  CLRWDT
00FF:  MOVLW  47
0100:  MOVWF  77
0101:  DECFSZ 77,F
0102:  GOTO   101
0103:  NOP
....................       output_high(TXo); 
0104:  BSF    03.5
0105:  BCF    06.5
0106:  BCF    03.5
0107:  BSF    06.5
....................       TAILH; 
0108:  CLRWDT
0109:  MOVLW  18
010A:  MOVWF  77
010B:  DECFSZ 77,F
010C:  GOTO   10B
010D:  NOP
010E:  NOP
....................     } 
....................     else 
010F:  GOTO   123
....................     { 
....................       output_low(TXo); 
0110:  BSF    03.5
0111:  BCF    06.5
0112:  BCF    03.5
0113:  BCF    06.5
....................       PERIODAL; 
0114:  CLRWDT
0115:  MOVLW  85
0116:  MOVWF  77
0117:  DECFSZ 77,F
0118:  GOTO   117
....................       output_high(TXo); 
0119:  BSF    03.5
011A:  BCF    06.5
011B:  BCF    03.5
011C:  BSF    06.5
....................       TAILL; 
011D:  CLRWDT
011E:  MOVLW  6F
011F:  MOVWF  77
0120:  DECFSZ 77,F
0121:  GOTO   120
0122:  NOP
....................     }; 
.................... } 
0123:  RETLW  00
....................  
.................... void SendByte (byte inbyte) 
.................... { 
....................    int k, bt; 
....................  
....................    for (k=0;k<8;k++)    //do the following for each of the 8 bits in the byte 
0124:  CLRF   73
0125:  MOVF   73,W
0126:  SUBLW  07
0127:  BTFSS  03.0
0128:  GOTO   16C
....................    { 
....................      bt = inbyte & 0x01;            //strip off the rightmost bit of the byte to be sent (inbyte) 
0129:  MOVF   72,W
012A:  ANDLW  01
012B:  MOVWF  74
....................      if ((fcs_flag == FALSE) & (flag_flag == FALSE)) fcsbit(bt);    //do FCS calc, but only if this 
012C:  MOVF   3E,F
012D:  BTFSC  03.2
012E:  GOTO   131
012F:  MOVLW  00
0130:  GOTO   132
0131:  MOVLW  01
0132:  MOVWF  75
0133:  MOVF   3D,F
0134:  BTFSC  03.2
0135:  GOTO   138
0136:  MOVLW  00
0137:  GOTO   139
0138:  MOVLW  01
0139:  ANDWF  75,W
013A:  XORLW  00
013B:  BTFSC  03.2
013C:  GOTO   14C
013D:  MOVF   74,W
013E:  MOVWF  75
....................                                                                                            //is not a flag or fcs byte 
....................      if (bt == 0) 
*
014C:  MOVF   74,F
014D:  BTFSS  03.2
014E:  GOTO   151
....................      { 
....................        flipout(); 
014F:  CALL   0DD
....................      }                                    // if this bit is a zero, flip the output state 
....................      else 
0150:  GOTO   167
....................      {                                                   //otherwise if it is a 1, do the following: 
....................        if (flag_flag == FALSE) stuff++;      //increment the count of consequtive 1's 
0151:  MOVF   3D,F
0152:  BTFSC  03.2
0153:  INCF   3C,F
....................        if ((flag_flag == FALSE) & (stuff == 5)) 
0154:  MOVF   3D,F
0155:  BTFSC  03.2
0156:  GOTO   159
0157:  MOVLW  00
0158:  GOTO   15A
0159:  MOVLW  01
015A:  MOVWF  75
015B:  MOVF   3C,W
015C:  SUBLW  05
015D:  BTFSC  03.2
015E:  GOTO   161
015F:  MOVLW  00
0160:  GOTO   162
0161:  MOVLW  01
0162:  ANDWF  75,W
0163:  BTFSC  03.2
0164:  GOTO   167
....................        {       //stuff an extra 0, if 5 1's in a row 
....................          SendBit(); 
0165:  CALL   0E4
....................          flipout();               //flip the output state to stuff a 0 
0166:  CALL   0DD
....................        }//end of if 
....................      }//end of else 
....................      // delay_us(850);                              //introduces a delay that creates 1200 baud 
....................      SendBit(); 
0167:  CALL   0E4
....................      inbyte = inbyte>>1;          //go to the next bit in the byte 
0168:  BCF    03.0
0169:  RRF    72,F
....................    }//end of for 
016A:  INCF   73,F
016B:  GOTO   125
.................... }//end of SendByte 
016C:  RETLW  00
....................  
.................... void SendPacket(char *data) 
.................... { 
....................     bit=FALSE; 
016D:  BCF    39.0
....................  
....................    fcslo=fcshi=0xFF;       //The 2 FCS Bytes are initialized to FF 
016E:  MOVLW  FF
016F:  MOVWF  3B
0170:  MOVWF  3A
....................    stuff = 0;              //The variable stuff counts the number of 1's in a row. When it gets to 5 
0171:  CLRF   3C
....................                                 // it is time to stuff a 0. 
....................  
.................... //   output_low(PTT);        // Blinking LED 
.................... //   delay_ms(1000); 
.................... //   output_high(PTT); 
....................  
....................    flag_flag = TRUE;       //The variable flag is true if you are transmitted flags (7E's) false otherwise. 
0172:  MOVLW  01
0173:  MOVWF  3D
....................    fcs_flag = FALSE;       //The variable fcsflag is true if you are transmitting FCS bytes, false otherwise. 
0174:  CLRF   3E
....................  
....................    for(i=0; i<10; i++) SendByte(0x7E); //Sends flag bytes.  Adjust length for txdelay 
0175:  CLRF   3F
0176:  MOVF   3F,W
0177:  SUBLW  09
0178:  BTFSS  03.0
0179:  GOTO   17F
017A:  MOVLW  7E
017B:  MOVWF  72
017C:  CALL   124
017D:  INCF   3F,F
017E:  GOTO   176
....................                                        //each flag takes approx 6.7 ms 
....................    flag_flag = FALSE;      //done sending flags 
017F:  CLRF   3D
....................  
....................    for(i=0; i<16; i++) SendByte(SendData[i]);      //send the packet bytes 
0180:  CLRF   3F
0181:  MOVF   3F,W
0182:  SUBLW  0F
0183:  BTFSS  03.0
0184:  GOTO   18E
0185:  MOVLW  29
0186:  ADDWF  3F,W
0187:  MOVWF  04
0188:  MOVF   00,W
0189:  MOVWF  71
018A:  MOVWF  72
018B:  CALL   124
018C:  INCF   3F,F
018D:  GOTO   181
....................  
....................    for(i=0; 0 != *data; i++) 
018E:  CLRF   3F
018F:  MOVF   70,W
0190:  MOVWF  04
0191:  MOVF   00,W
0192:  BTFSC  03.2
0193:  GOTO   19D
....................    { 
....................       SendByte(*data);     //send the packet bytes 
0194:  MOVF   70,W
0195:  MOVWF  04
0196:  MOVF   00,W
0197:  MOVWF  71
0198:  MOVWF  72
0199:  CALL   124
....................       data++; 
019A:  INCF   70,F
....................    }; 
019B:  INCF   3F,F
019C:  GOTO   18F
....................  
....................    fcs_flag = TRUE;        //about to send the FCS bytes 
019D:  MOVLW  01
019E:  MOVWF  3E
....................    fcslo =fcslo^0xff;      //must XOR them with FF before sending 
019F:  MOVLW  FF
01A0:  XORWF  3A,F
....................    fcshi = fcshi^0xff; 
01A1:  XORWF  3B,F
....................    SendByte(fcslo);        //send the low byte of fcs 
01A2:  MOVF   3A,W
01A3:  MOVWF  72
01A4:  CALL   124
....................    SendByte(fcshi);        //send the high byte of fcs 
01A5:  MOVF   3B,W
01A6:  MOVWF  72
01A7:  CALL   124
....................    fcs_flag = FALSE;                  //done sending FCS 
01A8:  CLRF   3E
....................    flag_flag = TRUE;               //about to send flags 
01A9:  MOVLW  01
01AA:  MOVWF  3D
....................    SendByte(0x7e);         // Send a flag to end packet 
01AB:  MOVLW  7E
01AC:  MOVWF  72
01AD:  CALL   124
.................... } 
01AE:  BCF    0A.3
01AF:  GOTO   2FD (RETURN)
....................  
....................  
....................  
....................  
.................... char AXstring[40];            // Buffer pro prenos telemetrie 
....................  
.................... #define REFSTART  95    // Hodnota odpovidajici 1,2V pri nezatizenych clancich 
.................... #define DUTY1     2     // Delka sepnuti PWM v us pro sero 
.................... #define DUTY2     19    // Delka sepnuti PWM v us pro jednu zarovku 500W 
....................  
.................... // Tabulka hodnot prevodniku pro ruzna napajeci napeti 
.................... //  80   3,99V 
.................... //  90   3,54V 
.................... // 100   3,20V 
.................... // 105   3,04V 
.................... // 107   2,99V 
.................... // 110   2,91v 
.................... // 200   1,61V 
....................  
.................... #define PIEZO     PIN_A6   // Jeden pol piezo reproduktoru 
.................... #define LED       PIN_A7   // LED / druhy pol piezo reproduktoru 
.................... #define MENIC     PIN_B3   // Spinani tranzistoru menice 
.................... #define REFPWR    PIN_B1   // Napajeni zdroje referencniho napeti 
.................... #define MOTOR     PIN_B2   // Spinani tranzistoru motoru 
.................... #define SW1       PIN_B6   // DIPswitch 1 
.................... #define SW2       PIN_B7   // DIPswitch 2 
.................... #define NAPETI    4        // Cislo kanalu DA prevodniku pro mereni napeti 
.................... #define PWM       0        // Cislo kanalu DA prevodniku pro nastaveni PWM 
.................... #define ROZJEZD   1        // Cislo kanalu DA prevodniku pro nastaveni rozjezdu 
....................  
.................... #byte SSPBUF   = 0x13   // Adresy registru jednotky SSP 
.................... #byte SSPCON1  = 0x14 
.................... #byte SSPSTAT  = 0x94 
....................  
.................... // Vzorky pro generovani PWM pomoci SSP 
.................... unsigned int8 const Pattern[8] = {0x02,0x06,0x0e,0x1e,0x3e,0x7e,0xfe,0xff}; 
.................... unsigned int8 MotorPattern; 
....................  
.................... #INT_SSP 
.................... void IntSSP() 
.................... { 
....................    SSPBUF=MotorPattern;             // znovu vysli stejnou hodnotu 
*
0037:  MOVF   68,W
0038:  MOVWF  13
.................... } 
....................  
0039:  BCF    0C.3
003A:  BCF    0A.3
003B:  GOTO   022
.................... void pip()     // pipnuti a bliknuti 
.................... { 
....................    int1 beep; 
....................    int i; 
....................  
....................    for(i=0; i<250; i++) 
*
005F:  CLRF   71
0060:  MOVF   71,W
0061:  SUBLW  F9
0062:  BTFSS  03.0
0063:  GOTO   081
....................    { 
....................       output_bit(PIEZO, beep); 
0064:  BTFSC  70.0
0065:  GOTO   068
0066:  BCF    05.6
0067:  GOTO   069
0068:  BSF    05.6
0069:  BSF    03.5
006A:  BCF    05.6
....................       beep=~beep; 
006B:  MOVLW  01
006C:  XORWF  70,F
....................       output_bit(LED, beep); 
006D:  BTFSC  70.0
006E:  GOTO   073
006F:  BCF    03.5
0070:  BCF    05.7
0071:  GOTO   075
0072:  BSF    03.5
0073:  BCF    03.5
0074:  BSF    05.7
0075:  BSF    03.5
0076:  BCF    05.7
....................       delay_us(100); 
0077:  CLRWDT
0078:  MOVLW  1F
0079:  MOVWF  77
007A:  DECFSZ 77,F
007B:  GOTO   07A
007C:  NOP
007D:  NOP
....................    }; 
007E:  INCF   71,F
007F:  BCF    03.5
0080:  GOTO   060
....................    output_high(PIEZO); 
0081:  BSF    03.5
0082:  BCF    05.6
0083:  BCF    03.5
0084:  BSF    05.6
....................    output_high(LED); 
0085:  BSF    03.5
0086:  BCF    05.7
0087:  BCF    03.5
0088:  BSF    05.7
.................... } 
0089:  BCF    0A.3
008A:  GOTO   2B1 (RETURN)
....................  
.................... void cvak()    // pouze cvaknuti piezoelementem bez bliknuti 
.................... { 
....................    output_bit(PIEZO,~input(PIEZO)); 
*
0052:  BSF    03.5
0053:  BSF    05.6
0054:  BCF    03.5
0055:  BTFSS  05.6
0056:  GOTO   059
0057:  BCF    05.6
0058:  GOTO   05A
0059:  BSF    05.6
005A:  BSF    03.5
005B:  BCF    05.6
.................... } 
005C:  BCF    03.5
005D:  BCF    0A.3
005E:  GOTO   263 (RETURN)
....................  
.................... void main() 
.................... { 
*
01C3:  CLRF   04
01C4:  MOVLW  1F
01C5:  ANDWF  03,F
01C6:  BSF    03.5
01C7:  BCF    1F.4
01C8:  BCF    1F.5
01C9:  MOVF   1B,W
01CA:  ANDLW  80
01CB:  MOVWF  1B
01CC:  MOVLW  07
01CD:  MOVWF  1C
....................    int8 n; 
....................    int8 perioda; 
....................    int8 razeni; 
....................    int8 uclanku; 
....................    int16 ble; 
....................  
....................    setup_timer_0(RTCC_INTERNAL);setup_wdt(WDT_1152MS); 
*
01EB:  BSF    03.5
01EC:  MOVF   01,W
01ED:  ANDLW  C0
01EE:  MOVWF  01
01EF:  MOVLW  0E
01F0:  MOVWF  77
01F1:  MOVLW  07
01F2:  BCF    03.5
01F3:  CLRF   01
01F4:  MOVLW  81
01F5:  MOVWF  04
01F6:  MOVF   00,W
01F7:  ANDLW  F0
01F8:  IORLW  07
01F9:  MOVWF  00
01FA:  CLRWDT
01FB:  MOVF   00,W
01FC:  ANDLW  F7
01FD:  BTFSC  77.3
01FE:  ANDLW  F0
01FF:  IORWF  77,W
0200:  MOVWF  00
....................    setup_timer_1(T1_DISABLED); 
0201:  CLRF   10
....................    setup_adc_ports(ADC_CLOCK_INTERNAL|sAN0|sAN1|sAN4|VSS_VDD); 
0202:  BSF    03.5
0203:  BCF    1F.4
0204:  BCF    1F.5
0205:  MOVF   1B,W
0206:  ANDLW  80
0207:  IORLW  D3
0208:  MOVWF  1B
....................    setup_adc(ADC_CLOCK_INTERNAL); 
0209:  BCF    1F.6
020A:  BCF    03.5
020B:  BSF    1F.6
020C:  BSF    1F.7
020D:  BSF    03.5
020E:  BCF    1F.7
020F:  BCF    03.5
0210:  BSF    1F.0
....................    setup_spi(FALSE); 
0211:  BCF    14.5
0212:  BSF    03.5
0213:  BCF    06.2
0214:  BSF    06.1
0215:  BCF    06.4
0216:  MOVLW  00
0217:  BCF    03.5
0218:  MOVWF  14
0219:  BSF    03.5
021A:  MOVWF  14
....................    setup_comparator(NC_NC_NC_NC); 
021B:  MOVLW  07
021C:  MOVWF  1C
021D:  MOVF   05,W
021E:  CLRWDT
021F:  MOVLW  02
0220:  MOVWF  77
0221:  DECFSZ 77,F
0222:  GOTO   221
0223:  NOP
0224:  MOVF   1C,W
0225:  BCF    03.5
0226:  BCF    0D.6
....................    setup_vref(FALSE); 
0227:  BSF    03.5
0228:  CLRF   1D
....................  
....................    output_low(MENIC);      // Vsechno zastav 
0229:  BCF    06.3
022A:  BCF    03.5
022B:  BCF    06.3
....................    output_low(MOTOR); 
022C:  BSF    03.5
022D:  BCF    06.2
022E:  BCF    03.5
022F:  BCF    06.2
....................    output_low(REFPWR); 
0230:  BSF    03.5
0231:  BCF    06.1
0232:  BCF    03.5
0233:  BCF    06.1
....................    output_high(LED); 
0234:  BSF    03.5
0235:  BCF    05.7
0236:  BCF    03.5
0237:  BSF    05.7
....................    output_high(PIEZO); 
0238:  BSF    03.5
0239:  BCF    05.6
023A:  BCF    03.5
023B:  BSF    05.6
....................  
....................    set_adc_channel(NAPETI);     // Vyber AD kanal pro pomerne mereni napeti 
023C:  MOVLW  20
023D:  MOVWF  78
023E:  MOVF   1F,W
023F:  ANDLW  C7
0240:  IORWF  78,W
0241:  MOVWF  1F
....................    set_pwm1_duty(0);       // Spust PWM, ale zatim s trvalou 0 na vystupu 
0242:  CLRF   15
....................    setup_ccp1(CCP_PWM); 
0243:  BSF    03.5
0244:  BCF    06.3
0245:  BCF    03.5
0246:  BCF    06.3
0247:  MOVLW  0C
0248:  MOVWF  17
....................    setup_timer_2(T2_DIV_BY_1,100,1);  // perioda 
0249:  MOVLW  00
024A:  MOVWF  78
024B:  IORLW  04
024C:  MOVWF  12
024D:  MOVLW  64
024E:  BSF    03.5
024F:  MOVWF  12
....................  
....................    setup_oscillator(OSC_4MHZ|OSC_INTRC);  // rozjed PIC (zvysi se odber) 
0250:  MOVLW  62
0251:  MOVWF  0F
....................  
.................... // jsme v depu? 
....................    set_pwm1_duty(DUTY1);          // PWM pro zatizeni clanku pri malem osvetleni 
0252:  MOVLW  02
0253:  BCF    03.5
0254:  MOVWF  15
....................    n=0; 
0255:  CLRF   6A
....................    do 
....................    { 
....................       output_low(REFPWR);  // Vypni napajeni napetove reference, aby se setrilo 
0256:  BSF    03.5
0257:  BCF    06.1
0258:  BCF    03.5
0259:  BCF    06.1
....................       delay_ms(100); 
025A:  MOVLW  64
025B:  MOVWF  71
025C:  CALL   03C
....................       if (4==n++) {cvak(); n=0;};   // Kazdy 4. pruchod cvakni 
025D:  MOVF   6A,W
025E:  INCF   6A,F
025F:  SUBLW  04
0260:  BTFSS  03.2
0261:  GOTO   264
0262:  GOTO   052
0263:  CLRF   6A
....................       output_high(REFPWR);          // Zapni napajeni napetove reference 
0264:  BSF    03.5
0265:  BCF    06.1
0266:  BCF    03.5
0267:  BSF    06.1
....................       delay_ms(1);                  // Pockej na ustaleni napeti 
0268:  MOVLW  01
0269:  MOVWF  71
026A:  CALL   03C
....................    } while (read_adc()>REFSTART);   // Odkryl starter clanky? 
026B:  BSF    1F.2
026C:  BTFSC  1F.2
026D:  GOTO   26C
026E:  MOVF   1E,W
026F:  SUBLW  5F
0270:  BTFSS  03.0
0271:  GOTO   256
....................    output_low(REFPWR);     // Vypni napajeni napetove reference, aby se setrilo 
0272:  BSF    03.5
0273:  BCF    06.1
0274:  BCF    03.5
0275:  BCF    06.1
....................  
.................... //   port_b_pullups(TRUE);            // Zapni pullupy, aby slo cist DIPswitch 
.................... //   do 
.................... //   { 
....................       // Precti trimry 
....................       set_adc_channel(PWM);         // Zjisteni nastaveni PWM 
0276:  MOVLW  00
0277:  MOVWF  78
0278:  MOVF   1F,W
0279:  ANDLW  C7
027A:  IORWF  78,W
027B:  MOVWF  1F
....................       delay_us(100);                // Pockej na prepnuti kanalu A/D prevodniku 
027C:  CLRWDT
027D:  MOVLW  1F
027E:  MOVWF  77
027F:  DECFSZ 77,F
0280:  GOTO   27F
0281:  NOP
0282:  NOP
....................       perioda=(read_adc()>>2)+40;   // rozsah: 40 az 103 
0283:  BSF    1F.2
0284:  BTFSC  1F.2
0285:  GOTO   284
0286:  MOVF   1E,W
0287:  MOVWF  77
0288:  RRF    77,F
0289:  RRF    77,F
028A:  MOVLW  3F
028B:  ANDWF  77,F
028C:  MOVF   77,W
028D:  ADDLW  28
028E:  MOVWF  6B
....................  
....................       set_adc_channel(ROZJEZD);     // Zjisteni nastaveni rozjezdu 
028F:  MOVLW  08
0290:  MOVWF  78
0291:  MOVF   1F,W
0292:  ANDLW  C7
0293:  IORWF  78,W
0294:  MOVWF  1F
....................       delay_us(100);                // Pockej na prepnuti kanalu A/D prevodniku 
0295:  CLRWDT
0296:  MOVLW  1F
0297:  MOVWF  77
0298:  DECFSZ 77,F
0299:  GOTO   298
029A:  NOP
029B:  NOP
....................       razeni=read_adc()>>3;         // rozsah: 0 az 31 
029C:  BSF    1F.2
029D:  BTFSC  1F.2
029E:  GOTO   29D
029F:  RRF    1E,W
02A0:  MOVWF  6C
02A1:  RRF    6C,F
02A2:  RRF    6C,F
02A3:  MOVLW  1F
02A4:  ANDWF  6C,F
....................  
....................       // Rozjeti menice 
....................       set_pwm1_duty(0);    // Zastav PWM, aby slo nastavit jinou frekvenci 
02A5:  CLRF   15
....................       setup_timer_2(T2_DIV_BY_1,perioda,1);    // perioda 
02A6:  MOVLW  00
02A7:  MOVWF  78
02A8:  IORLW  04
02A9:  MOVWF  12
02AA:  MOVF   6B,W
02AB:  BSF    03.5
02AC:  MOVWF  12
....................       set_pwm1_duty(DUTY2); // PWM pro zatizeni clanku pri jedne 500W zarovce 
02AD:  MOVLW  13
02AE:  BCF    03.5
02AF:  MOVWF  15
....................  
....................       pip();                  // potvrzeni odstartovani / servisni mod 
02B0:  GOTO   05F
....................       delay_ms(500); 
02B1:  MOVLW  02
02B2:  MOVWF  70
02B3:  MOVLW  FA
02B4:  MOVWF  71
02B5:  CALL   03C
02B6:  DECFSZ 70,F
02B7:  GOTO   2B3
....................  
.................... //   } while (input(SW1));      // Je zapnut servisni mod? SW1(OFF)=ANO 
.................... //   port_b_pullups(FALSE);     // Vypni pullupy, aby se setrilo energii 
....................  
....................    // zmereni napeti na clancich 
....................    output_high(REFPWR);          // Prepni AD na mereni napeti clanku 
02B8:  BSF    03.5
02B9:  BCF    06.1
02BA:  BCF    03.5
02BB:  BSF    06.1
....................    set_adc_channel(NAPETI);      // Prepni Zmer napeti clanku 
02BC:  MOVLW  20
02BD:  MOVWF  78
02BE:  MOVF   1F,W
02BF:  ANDLW  C7
02C0:  IORWF  78,W
02C1:  MOVWF  1F
....................    delay_us(50);                // Pockej na prepnuti kanalu A/D prevodniku 
02C2:  CLRWDT
02C3:  MOVLW  0F
02C4:  MOVWF  77
02C5:  DECFSZ 77,F
02C6:  GOTO   2C5
02C7:  NOP
....................    uclanku=read_adc(); 
02C8:  BSF    1F.2
02C9:  BTFSC  1F.2
02CA:  GOTO   2C9
02CB:  MOVF   1E,W
02CC:  MOVWF  6D
....................    output_low(REFPWR);     // odpoj odpor pro mereni napeti 
02CD:  BSF    03.5
02CE:  BCF    06.1
02CF:  BCF    03.5
02D0:  BCF    06.1
....................  
....................    // posli telemetrii 
....................    sprintf(AXstring,"p=%u r=%u u=%u", perioda, razeni, uclanku);  // Convert DATA to String. 
*
01EA:  CLRF   69
*
02D1:  MOVLW  40
02D2:  MOVWF  69
02D3:  MOVLW  70
02D4:  MOVWF  72
02D5:  CALL   08B
02D6:  MOVLW  3D
02D7:  MOVWF  72
02D8:  CALL   08B
02D9:  MOVF   6B,W
02DA:  MOVWF  70
02DB:  MOVLW  1B
02DC:  MOVWF  71
02DD:  CALL   0A8
02DE:  MOVLW  20
02DF:  MOVWF  72
02E0:  CALL   08B
02E1:  MOVLW  72
02E2:  MOVWF  72
02E3:  CALL   08B
02E4:  MOVLW  3D
02E5:  MOVWF  72
02E6:  CALL   08B
02E7:  MOVF   6C,W
02E8:  MOVWF  70
02E9:  MOVLW  1B
02EA:  MOVWF  71
02EB:  CALL   0A8
02EC:  MOVLW  20
02ED:  MOVWF  72
02EE:  CALL   08B
02EF:  MOVLW  75
02F0:  MOVWF  72
02F1:  CALL   08B
02F2:  MOVLW  3D
02F3:  MOVWF  72
02F4:  CALL   08B
02F5:  MOVF   6D,W
02F6:  MOVWF  70
02F7:  MOVLW  1B
02F8:  MOVWF  71
02F9:  CALL   0A8
....................    SendPacket(&AXstring[0]); 
02FA:  MOVLW  40
02FB:  MOVWF  70
02FC:  GOTO   16D
....................  
....................    delay_ms(14000);           // Pockame do 14.5s 
02FD:  MOVLW  38
02FE:  MOVWF  70
02FF:  MOVLW  FA
0300:  MOVWF  71
0301:  CALL   03C
0302:  DECFSZ 70,F
0303:  GOTO   2FF
....................  
....................    // rozjezd 
....................    for(ble=1;ble<=1000;ble++) 
0304:  CLRF   6F
0305:  MOVLW  01
0306:  MOVWF  6E
0307:  MOVF   6F,W
0308:  SUBLW  03
0309:  BTFSS  03.0
030A:  GOTO   333
030B:  BTFSS  03.2
030C:  GOTO   311
030D:  MOVF   6E,W
030E:  SUBLW  E8
030F:  BTFSS  03.0
0310:  GOTO   333
....................    {    
....................       for(n=0;n<=razeni;n++) 
0311:  CLRF   6A
0312:  MOVF   6A,W
0313:  SUBWF  6C,W
0314:  BTFSS  03.0
0315:  GOTO   32F
....................       { 
....................          output_high(MOTOR);               
0316:  BSF    03.5
0317:  BCF    06.2
0318:  BCF    03.5
0319:  BSF    06.2
....................          delay_us(ble);    
031A:  MOVF   6E,W
031B:  MOVWF  72
031C:  CALL   1B0
....................          output_low(MOTOR);              
031D:  BSF    03.5
031E:  BCF    06.2
031F:  BCF    03.5
0320:  BCF    06.2
....................          delay_us(1000-ble);    
0321:  MOVF   6E,W
0322:  SUBLW  E8
0323:  MOVWF  70
0324:  MOVLW  03
0325:  MOVWF  71
0326:  MOVF   6F,W
0327:  BTFSS  03.0
0328:  INCFSZ 6F,W
0329:  SUBWF  71,F
032A:  MOVF   70,W
032B:  MOVWF  72
032C:  CALL   1B0
....................       } 
032D:  INCF   6A,F
032E:  GOTO   312
....................    } 
032F:  INCF   6E,F
0330:  BTFSC  03.2
0331:  INCF   6F,F
0332:  GOTO   307
....................  
.................... // jedem co to da 
....................    output_high(MOTOR); 
0333:  BSF    03.5
0334:  BCF    06.2
0335:  BCF    03.5
0336:  BSF    06.2
....................  
....................    delay_ms(1300);                  // Nemeli bysme jet dele nez 1,3s :-) 
0337:  MOVLW  0A
0338:  MOVWF  70
0339:  MOVLW  82
033A:  MOVWF  71
033B:  CALL   03C
033C:  DECFSZ 70,F
033D:  GOTO   339
....................    output_low(MOTOR);               // Zastav motor 
033E:  BSF    03.5
033F:  BCF    06.2
0340:  BCF    03.5
0341:  BCF    06.2
....................                                     // Menic je stale zapnut a zatezuje clanky 
....................  
....................    while(TRUE);            // Cekej, dokud se neztrati svetlo, 
0342:  GOTO   342
....................                            // nebo prijde WatchDog 
....................  
.................... } 
0343:  SLEEP

Configuration Fuses:
   Word  1: 2738   NOWDT NOPUT MCLR NOBROWNOUT NOLVP NOCPD NOWRT DEBUG CCPB3 NOPROTECT INTRC_IO
   Word  2: 3FFC   NOFCMEN NOIESO