Subversion Repositories svnkaklik

Rev

Blame | Last modification | View Log | Download

CCS PCM C Compiler, Version 3.245, 27853               12-IX-06 23:20

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

               ROM used: 837 words (20%)
                         Largest free fragment is 2048
               RAM used: 85 (49%) at main() level
                         91 (52%) worst case
               Stack:    4 worst case (3 in main + 1 for interrupts)

*
0000:  MOVLW  00
0001:  MOVWF  0A
0002:  GOTO   1BA
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   043
.................... // ************************************* 
.................... // * 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   WDT,INTRC_IO, NOPUT, MCLR, NOBROWNOUT, NOLVP, NOCPD, \ 
....................          NOWRT, DEBUG, NOPROTECT, NOFCMEN, NOIESO, CCPB3 
....................  
.................... #use delay(clock=3900000,RESTART_WDT) 
*
0048:  MOVLW  6F
0049:  MOVWF  04
004A:  MOVF   00,W
004B:  BTFSC  03.2
004C:  GOTO   05D
004D:  MOVLW  01
004E:  MOVWF  78
004F:  MOVLW  BF
0050:  MOVWF  77
0051:  CLRWDT
0052:  DECFSZ 77,F
0053:  GOTO   051
0054:  DECFSZ 78,F
0055:  GOTO   04F
0056:  MOVLW  42
0057:  MOVWF  77
0058:  DECFSZ 77,F
0059:  GOTO   058
005A:  CLRWDT
005B:  DECFSZ 00,F
005C:  GOTO   04D
005D:  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}; 
*
01C5:  MOVLW  82
01C6:  BCF    03.5
01C7:  MOVWF  29
01C8:  MOVLW  98
01C9:  MOVWF  2A
01CA:  MOVWF  2B
01CB:  MOVLW  40
01CC:  MOVWF  2C
01CD:  MOVWF  2D
01CE:  MOVWF  2E
01CF:  MOVLW  60
01D0:  MOVWF  2F
01D1:  MOVLW  86
01D2:  MOVWF  30
01D3:  MOVLW  B4
01D4:  MOVWF  31
01D5:  MOVLW  60
01D6:  MOVWF  32
01D7:  MOVLW  A4
01D8:  MOVWF  33
01D9:  MOVWF  34
01DA:  MOVWF  35
01DB:  MOVLW  61
01DC:  MOVWF  36
01DD:  MOVLW  03
01DE:  MOVWF  37
01DF:  MOVLW  F0
01E0:  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 
*
00E7:  CLRF   3C
....................    if (bit) 
00E8:  BTFSS  39.0
00E9:  GOTO   0EC
....................    { 
....................      bit=FALSE;      //if the state of the pin was low, make it high. 
00EA:  BCF    39.0
....................    } 
....................    else 
00EB:  GOTO   0ED
....................    { 
....................      bit=TRUE;                //if the state of the pin was high make it low 
00EC:  BSF    39.0
....................    } 
.................... } 
00ED:  RETLW  00
....................  
.................... void fcsbit(byte tbyte) 
.................... { 
.................... #asm 
....................    BCF    STATUS,0 
*
0149:  BCF    03.0
....................    RRF    fcshi,F             // rotates the entire 16 bits 
014A:  RRF    3B,F
....................    RRF    fcslo,F                        // to the right 
014B:  RRF    3A,F
.................... #endasm 
....................    if (((STATUS & 0x01)^(tbyte)) ==0x01) 
014C:  MOVF   03,W
014D:  ANDLW  01
014E:  XORWF  73,W
014F:  SUBLW  01
0150:  BTFSS  03.2
0151:  GOTO   156
....................    { 
....................          fcshi = fcshi^0x84; 
0152:  MOVLW  84
0153:  XORWF  3B,F
....................          fcslo = fcslo^0x08; 
0154:  MOVLW  08
0155:  XORWF  3A,F
....................    } 
.................... } 
....................  
.................... void SendBit () 
.................... { 
....................    if (bit) 
*
00EE:  BTFSS  39.0
00EF:  GOTO   11A
....................    { 
....................       output_low(TXo); 
00F0:  BSF    03.5
00F1:  BCF    06.5
00F2:  BCF    03.5
00F3:  BCF    06.5
....................       PERIODAH; 
00F4:  CLRWDT
00F5:  MOVLW  47
00F6:  MOVWF  77
00F7:  DECFSZ 77,F
00F8:  GOTO   0F7
00F9:  NOP
....................       output_high(TXo); 
00FA:  BSF    03.5
00FB:  BCF    06.5
00FC:  BCF    03.5
00FD:  BSF    06.5
....................       PERIODAH; 
00FE:  CLRWDT
00FF:  MOVLW  47
0100:  MOVWF  77
0101:  DECFSZ 77,F
0102:  GOTO   101
0103:  NOP
....................       output_low(TXo); 
0104:  BSF    03.5
0105:  BCF    06.5
0106:  BCF    03.5
0107:  BCF    06.5
....................       PERIODAH; 
0108:  CLRWDT
0109:  MOVLW  47
010A:  MOVWF  77
010B:  DECFSZ 77,F
010C:  GOTO   10B
010D:  NOP
....................       output_high(TXo); 
010E:  BSF    03.5
010F:  BCF    06.5
0110:  BCF    03.5
0111:  BSF    06.5
....................       TAILH; 
0112:  CLRWDT
0113:  MOVLW  18
0114:  MOVWF  77
0115:  DECFSZ 77,F
0116:  GOTO   115
0117:  NOP
0118:  NOP
....................     } 
....................     else 
0119:  GOTO   12D
....................     { 
....................       output_low(TXo); 
011A:  BSF    03.5
011B:  BCF    06.5
011C:  BCF    03.5
011D:  BCF    06.5
....................       PERIODAL; 
011E:  CLRWDT
011F:  MOVLW  85
0120:  MOVWF  77
0121:  DECFSZ 77,F
0122:  GOTO   121
....................       output_high(TXo); 
0123:  BSF    03.5
0124:  BCF    06.5
0125:  BCF    03.5
0126:  BSF    06.5
....................       TAILL; 
0127:  CLRWDT
0128:  MOVLW  6F
0129:  MOVWF  77
012A:  DECFSZ 77,F
012B:  GOTO   12A
012C:  NOP
....................     }; 
.................... } 
012D:  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 
012E:  CLRF   71
012F:  MOVF   71,W
0130:  SUBLW  07
0131:  BTFSS  03.0
0132:  GOTO   176
....................    { 
....................      bt = inbyte & 0x01;            //strip off the rightmost bit of the byte to be sent (inbyte) 
0133:  MOVF   70,W
0134:  ANDLW  01
0135:  MOVWF  72
....................      if ((fcs_flag == FALSE) & (flag_flag == FALSE)) fcsbit(bt);    //do FCS calc, but only if this 
0136:  MOVF   3E,F
0137:  BTFSC  03.2
0138:  GOTO   13B
0139:  MOVLW  00
013A:  GOTO   13C
013B:  MOVLW  01
013C:  MOVWF  73
013D:  MOVF   3D,F
013E:  BTFSC  03.2
013F:  GOTO   142
0140:  MOVLW  00
0141:  GOTO   143
0142:  MOVLW  01
0143:  ANDWF  73,W
0144:  XORLW  00
0145:  BTFSC  03.2
0146:  GOTO   156
0147:  MOVF   72,W
0148:  MOVWF  73
....................                                                                                            //is not a flag or fcs byte 
....................      if (bt == 0) 
*
0156:  MOVF   72,F
0157:  BTFSS  03.2
0158:  GOTO   15B
....................      { 
....................        flipout(); 
0159:  CALL   0E7
....................      }                                    // if this bit is a zero, flip the output state 
....................      else 
015A:  GOTO   171
....................      {                                                   //otherwise if it is a 1, do the following: 
....................        if (flag_flag == FALSE) stuff++;      //increment the count of consequtive 1's 
015B:  MOVF   3D,F
015C:  BTFSC  03.2
015D:  INCF   3C,F
....................        if ((flag_flag == FALSE) & (stuff == 5)) 
015E:  MOVF   3D,F
015F:  BTFSC  03.2
0160:  GOTO   163
0161:  MOVLW  00
0162:  GOTO   164
0163:  MOVLW  01
0164:  MOVWF  73
0165:  MOVF   3C,W
0166:  SUBLW  05
0167:  BTFSC  03.2
0168:  GOTO   16B
0169:  MOVLW  00
016A:  GOTO   16C
016B:  MOVLW  01
016C:  ANDWF  73,W
016D:  BTFSC  03.2
016E:  GOTO   171
....................        {       //stuff an extra 0, if 5 1's in a row 
....................          SendBit(); 
016F:  CALL   0EE
....................          flipout();               //flip the output state to stuff a 0 
0170:  CALL   0E7
....................        }//end of if 
....................      }//end of else 
....................      // delay_us(850);                              //introduces a delay that creates 1200 baud 
....................      SendBit(); 
0171:  CALL   0EE
....................      inbyte = inbyte>>1;          //go to the next bit in the byte 
0172:  BCF    03.0
0173:  RRF    70,F
....................    }//end of for 
0174:  INCF   71,F
0175:  GOTO   12F
.................... }//end of SendByte 
0176:  RETLW  00
....................  
.................... void SendPacket(char *data) 
.................... { 
....................     bit=FALSE; 
0177:  BCF    39.0
....................  
....................    fcslo=fcshi=0xFF;       //The 2 FCS Bytes are initialized to FF 
0178:  MOVLW  FF
0179:  MOVWF  3B
017A:  MOVWF  3A
....................    stuff = 0;              //The variable stuff counts the number of 1's in a row. When it gets to 5 
017B:  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. 
017C:  MOVLW  01
017D:  MOVWF  3D
....................    fcs_flag = FALSE;       //The variable fcsflag is true if you are transmitting FCS bytes, false otherwise. 
017E:  CLRF   3E
....................  
....................    for(i=0; i<10; i++) SendByte(0x7E); //Sends flag bytes.  Adjust length for txdelay 
017F:  CLRF   3F
0180:  MOVF   3F,W
0181:  SUBLW  09
0182:  BTFSS  03.0
0183:  GOTO   189
0184:  MOVLW  7E
0185:  MOVWF  70
0186:  CALL   12E
0187:  INCF   3F,F
0188:  GOTO   180
....................                                        //each flag takes approx 6.7 ms 
....................    flag_flag = FALSE;      //done sending flags 
0189:  CLRF   3D
....................  
....................    for(i=0; i<16; i++) SendByte(SendData[i]);      //send the packet bytes 
018A:  CLRF   3F
018B:  MOVF   3F,W
018C:  SUBLW  0F
018D:  BTFSS  03.0
018E:  GOTO   198
018F:  MOVLW  29
0190:  ADDWF  3F,W
0191:  MOVWF  04
0192:  MOVF   00,W
0193:  MOVWF  6F
0194:  MOVWF  70
0195:  CALL   12E
0196:  INCF   3F,F
0197:  GOTO   18B
....................  
....................    for(i=0; 0 != *data; i++) 
0198:  CLRF   3F
0199:  MOVF   6E,W
019A:  MOVWF  04
019B:  MOVF   00,W
019C:  BTFSC  03.2
019D:  GOTO   1A7
....................    { 
....................       SendByte(*data);     //send the packet bytes 
019E:  MOVF   6E,W
019F:  MOVWF  04
01A0:  MOVF   00,W
01A1:  MOVWF  6F
01A2:  MOVWF  70
01A3:  CALL   12E
....................       data++; 
01A4:  INCF   6E,F
....................    }; 
01A5:  INCF   3F,F
01A6:  GOTO   199
....................  
....................    fcs_flag = TRUE;        //about to send the FCS bytes 
01A7:  MOVLW  01
01A8:  MOVWF  3E
....................    fcslo =fcslo^0xff;      //must XOR them with FF before sending 
01A9:  MOVLW  FF
01AA:  XORWF  3A,F
....................    fcshi = fcshi^0xff; 
01AB:  XORWF  3B,F
....................    SendByte(fcslo);        //send the low byte of fcs 
01AC:  MOVF   3A,W
01AD:  MOVWF  70
01AE:  CALL   12E
....................    SendByte(fcshi);        //send the high byte of fcs 
01AF:  MOVF   3B,W
01B0:  MOVWF  70
01B1:  CALL   12E
....................    fcs_flag = FALSE;                  //done sending FCS 
01B2:  CLRF   3E
....................    flag_flag = TRUE;               //about to send flags 
01B3:  MOVLW  01
01B4:  MOVWF  3D
....................    SendByte(0x7e);         // Send a flag to end packet 
01B5:  MOVLW  7E
01B6:  MOVWF  70
01B7:  CALL   12E
.................... } 
01B8:  BCF    0A.3
01B9:  GOTO   30C (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 
*
0043:  MOVF   68,W
0044:  MOVWF  13
.................... } 
....................  
0045:  BCF    0C.3
0046:  BCF    0A.3
0047:  GOTO   022
.................... void pip()     // pipnuti a bliknuti 
.................... { 
....................    int1 beep; 
....................    int i; 
....................  
....................    for(i=0; i<250; i++) 
*
006B:  CLRF   6F
006C:  MOVF   6F,W
006D:  SUBLW  F9
006E:  BTFSS  03.0
006F:  GOTO   08B
....................    { 
....................       output_bit(PIEZO, beep); 
0070:  BTFSC  6E.0
0071:  GOTO   074
0072:  BCF    05.6
0073:  GOTO   075
0074:  BSF    05.6
0075:  BSF    03.5
0076:  BCF    05.6
....................       beep=~beep; 
0077:  MOVLW  01
0078:  BCF    03.5
0079:  XORWF  6E,F
....................       output_bit(LED, beep); 
007A:  BTFSC  6E.0
007B:  GOTO   07E
007C:  BCF    05.7
007D:  GOTO   07F
007E:  BSF    05.7
007F:  BSF    03.5
0080:  BCF    05.7
....................       delay_us(100); 
0081:  CLRWDT
0082:  MOVLW  1F
0083:  MOVWF  77
0084:  DECFSZ 77,F
0085:  GOTO   084
0086:  NOP
0087:  NOP
....................    }; 
0088:  BCF    03.5
0089:  INCF   6F,F
008A:  GOTO   06C
....................    output_high(PIEZO); 
008B:  BSF    03.5
008C:  BCF    05.6
008D:  BCF    03.5
008E:  BSF    05.6
....................    output_high(LED); 
008F:  BSF    03.5
0090:  BCF    05.7
0091:  BCF    03.5
0092:  BSF    05.7
.................... } 
0093:  BCF    0A.3
0094:  GOTO   2A3 (RETURN)
....................  
.................... void cvak()    // pouze cvaknuti piezoelementem bez bliknuti 
.................... { 
....................    output_bit(PIEZO,~input(PIEZO)); 
*
005E:  BSF    03.5
005F:  BSF    05.6
0060:  BCF    03.5
0061:  BTFSS  05.6
0062:  GOTO   065
0063:  BCF    05.6
0064:  GOTO   066
0065:  BSF    05.6
0066:  BSF    03.5
0067:  BCF    05.6
.................... } 
0068:  BCF    03.5
0069:  BCF    0A.3
006A:  GOTO   25A (RETURN)
....................  
.................... void main() 
.................... { 
*
01BA:  CLRF   04
01BB:  MOVLW  1F
01BC:  ANDWF  03,F
01BD:  BSF    03.5
01BE:  BCF    1F.4
01BF:  BCF    1F.5
01C0:  MOVF   1B,W
01C1:  ANDLW  80
01C2:  MOVWF  1B
01C3:  MOVLW  07
01C4:  MOVWF  1C
....................    int8 n; 
....................    int8 perioda; 
....................    int8 razeni; 
....................    int8 uclanku; 
....................  
....................    setup_timer_0(RTCC_INTERNAL);setup_wdt(WDT_1152MS); 
*
01E2:  BSF    03.5
01E3:  MOVF   01,W
01E4:  ANDLW  C0
01E5:  MOVWF  01
01E6:  MOVLW  0E
01E7:  MOVWF  77
01E8:  MOVLW  07
01E9:  BCF    03.5
01EA:  CLRF   01
01EB:  MOVLW  81
01EC:  MOVWF  04
01ED:  MOVF   00,W
01EE:  ANDLW  F0
01EF:  IORLW  07
01F0:  MOVWF  00
01F1:  CLRWDT
01F2:  MOVF   00,W
01F3:  ANDLW  F7
01F4:  BTFSC  77.3
01F5:  ANDLW  F0
01F6:  IORWF  77,W
01F7:  MOVWF  00
....................    setup_timer_1(T1_DISABLED); 
01F8:  CLRF   10
....................    setup_adc_ports(ADC_CLOCK_INTERNAL|sAN0|sAN1|sAN4|VSS_VDD); 
01F9:  BSF    03.5
01FA:  BCF    1F.4
01FB:  BCF    1F.5
01FC:  MOVF   1B,W
01FD:  ANDLW  80
01FE:  IORLW  D3
01FF:  MOVWF  1B
....................    setup_adc(ADC_CLOCK_INTERNAL); 
0200:  BCF    1F.6
0201:  BCF    03.5
0202:  BSF    1F.6
0203:  BSF    1F.7
0204:  BSF    03.5
0205:  BCF    1F.7
0206:  BCF    03.5
0207:  BSF    1F.0
....................    setup_spi(FALSE); 
0208:  BCF    14.5
0209:  BSF    03.5
020A:  BCF    06.2
020B:  BSF    06.1
020C:  BCF    06.4
020D:  MOVLW  00
020E:  BCF    03.5
020F:  MOVWF  14
0210:  BSF    03.5
0211:  MOVWF  14
....................    setup_comparator(NC_NC_NC_NC); 
0212:  MOVLW  07
0213:  MOVWF  1C
0214:  MOVF   05,W
0215:  CLRWDT
0216:  MOVLW  02
0217:  MOVWF  77
0218:  DECFSZ 77,F
0219:  GOTO   218
021A:  NOP
021B:  MOVF   1C,W
021C:  BCF    03.5
021D:  BCF    0D.6
....................    setup_vref(FALSE); 
021E:  BSF    03.5
021F:  CLRF   1D
....................  
....................    output_low(MENIC);      // Vsechno zastav 
0220:  BCF    06.3
0221:  BCF    03.5
0222:  BCF    06.3
....................    output_low(MOTOR); 
0223:  BSF    03.5
0224:  BCF    06.2
0225:  BCF    03.5
0226:  BCF    06.2
....................    output_low(REFPWR); 
0227:  BSF    03.5
0228:  BCF    06.1
0229:  BCF    03.5
022A:  BCF    06.1
....................    output_high(LED); 
022B:  BSF    03.5
022C:  BCF    05.7
022D:  BCF    03.5
022E:  BSF    05.7
....................    output_high(PIEZO); 
022F:  BSF    03.5
0230:  BCF    05.6
0231:  BCF    03.5
0232:  BSF    05.6
....................  
....................    set_adc_channel(NAPETI);     // Vyber AD kanal pro pomerne mereni napeti 
0233:  MOVLW  20
0234:  MOVWF  78
0235:  MOVF   1F,W
0236:  ANDLW  C7
0237:  IORWF  78,W
0238:  MOVWF  1F
....................    set_pwm1_duty(0);       // Spust PWM, ale zatim s trvalou 0 na vystupu 
0239:  CLRF   15
....................    setup_ccp1(CCP_PWM); 
023A:  BSF    03.5
023B:  BCF    06.3
023C:  BCF    03.5
023D:  BCF    06.3
023E:  MOVLW  0C
023F:  MOVWF  17
....................    setup_timer_2(T2_DIV_BY_1,100,1);  // perioda 
0240:  MOVLW  00
0241:  MOVWF  78
0242:  IORLW  04
0243:  MOVWF  12
0244:  MOVLW  64
0245:  BSF    03.5
0246:  MOVWF  12
....................  
....................    setup_oscillator(OSC_4MHZ|OSC_INTRC);  // rozjed PIC (zvysi se odber) 
0247:  MOVLW  62
0248:  MOVWF  0F
....................  
.................... // jsme v depu? 
....................    set_pwm1_duty(DUTY1);          // PWM pro zatizeni clanku pri malem osvetleni 
0249:  MOVLW  02
024A:  BCF    03.5
024B:  MOVWF  15
....................    n=0; 
024C:  CLRF   6A
....................    do 
....................    { 
....................       output_low(REFPWR);  // Vypni napajeni napetove reference, aby se setrilo 
024D:  BSF    03.5
024E:  BCF    06.1
024F:  BCF    03.5
0250:  BCF    06.1
....................       delay_ms(100); 
0251:  MOVLW  64
0252:  MOVWF  6F
0253:  CALL   048
....................       if (4==n++) {cvak(); n=0;};   // Kazdy 4. pruchod cvakni 
0254:  MOVF   6A,W
0255:  INCF   6A,F
0256:  SUBLW  04
0257:  BTFSS  03.2
0258:  GOTO   25B
0259:  GOTO   05E
025A:  CLRF   6A
....................       output_high(REFPWR);          // Zapni napajeni napetove reference 
025B:  BSF    03.5
025C:  BCF    06.1
025D:  BCF    03.5
025E:  BSF    06.1
....................       delay_ms(1);                  // Pockej na ustaleni napeti 
025F:  MOVLW  01
0260:  MOVWF  6F
0261:  CALL   048
....................    } while (read_adc()>REFSTART);   // Odkryl starter clanky? 
0262:  BSF    1F.2
0263:  BTFSC  1F.2
0264:  GOTO   263
0265:  MOVF   1E,W
0266:  SUBLW  5F
0267:  BTFSS  03.0
0268:  GOTO   24D
....................    output_low(REFPWR);     // Vypni napajeni napetove reference, aby se setrilo 
0269:  BSF    03.5
026A:  BCF    06.1
026B:  BCF    03.5
026C:  BCF    06.1
....................  
.................... //   port_b_pullups(TRUE);            // Zapni pullupy, aby slo cist DIPswitch 
.................... //   do 
.................... //   { 
....................       // Precti trimry 
....................       set_adc_channel(PWM);         // Zjisteni nastaveni PWM 
026D:  MOVLW  00
026E:  MOVWF  78
026F:  MOVF   1F,W
0270:  ANDLW  C7
0271:  IORWF  78,W
0272:  MOVWF  1F
....................       delay_us(100);                // Pockej na prepnuti kanalu A/D prevodniku 
0273:  CLRWDT
0274:  MOVLW  1F
0275:  MOVWF  77
0276:  DECFSZ 77,F
0277:  GOTO   276
0278:  NOP
0279:  NOP
....................       perioda=(read_adc()>>1)+40;   // rozsah: 40 az 167 
027A:  BSF    1F.2
027B:  BTFSC  1F.2
027C:  GOTO   27B
027D:  MOVF   1E,W
027E:  MOVWF  77
027F:  BCF    03.0
0280:  RRF    77,F
0281:  MOVF   77,W
0282:  ADDLW  28
0283:  MOVWF  6B
....................  
....................       set_adc_channel(ROZJEZD);     // Zjisteni nastaveni rozjezdu 
0284:  MOVLW  08
0285:  MOVWF  78
0286:  MOVF   1F,W
0287:  ANDLW  C7
0288:  IORWF  78,W
0289:  MOVWF  1F
....................       delay_us(100);                // Pockej na prepnuti kanalu A/D prevodniku 
028A:  CLRWDT
028B:  MOVLW  1F
028C:  MOVWF  77
028D:  DECFSZ 77,F
028E:  GOTO   28D
028F:  NOP
0290:  NOP
....................       razeni=read_adc()>>1;         // rozsah: 0 az 127 
0291:  BSF    1F.2
0292:  BTFSC  1F.2
0293:  GOTO   292
0294:  BCF    03.0
0295:  RRF    1E,W
0296:  MOVWF  6C
....................  
....................       // Rozjeti menice 
....................       set_pwm1_duty(0);    // Zastav PWM, aby slo nastavit jinou frekvenci 
0297:  CLRF   15
....................       setup_timer_2(T2_DIV_BY_1,perioda,1);    // perioda 
0298:  MOVLW  00
0299:  MOVWF  78
029A:  IORLW  04
029B:  MOVWF  12
029C:  MOVF   6B,W
029D:  BSF    03.5
029E:  MOVWF  12
....................       set_pwm1_duty(DUTY2); // PWM pro zatizeni clanku pri jedne 500W zarovce 
029F:  MOVLW  13
02A0:  BCF    03.5
02A1:  MOVWF  15
....................  
....................       pip();                  // potvrzeni odstartovani / servisni mod 
02A2:  GOTO   06B
....................       delay_ms(500); 
02A3:  MOVLW  02
02A4:  MOVWF  6E
02A5:  MOVLW  FA
02A6:  MOVWF  6F
02A7:  CALL   048
02A8:  DECFSZ 6E,F
02A9:  GOTO   2A5
....................  
.................... //   } while (input(SW1));      // Je zapnut servisni mod? SW1(OFF)=ANO 
.................... //   port_b_pullups(FALSE);     // Vypni pullupy, aby se setrilo energii 
....................  
.................... // Regulace nabíjení 
....................    output_high(REFPWR);          // Prepni AD na mereni napeti clanku 
02AA:  BSF    03.5
02AB:  BCF    06.1
02AC:  BCF    03.5
02AD:  BSF    06.1
....................    set_adc_channel(NAPETI);      // Prepni Zmer napeti clanku 
02AE:  MOVLW  20
02AF:  MOVWF  78
02B0:  MOVF   1F,W
02B1:  ANDLW  C7
02B2:  IORWF  78,W
02B3:  MOVWF  1F
....................    delay_us(50);                // Pockej na prepnuti kanalu A/D prevodniku 
02B4:  CLRWDT
02B5:  MOVLW  0F
02B6:  MOVWF  77
02B7:  DECFSZ 77,F
02B8:  GOTO   2B7
02B9:  NOP
....................    for(n=1;n<=10;n++) 
02BA:  MOVLW  01
02BB:  MOVWF  6A
02BC:  MOVF   6A,W
02BD:  SUBLW  0A
02BE:  BTFSS  03.0
02BF:  GOTO   2DC
....................    { 
....................       // Zmer napeti (aktualni zatizeni clanku) 
....................       uclanku=read_adc(); 
02C0:  BSF    1F.2
02C1:  BTFSC  1F.2
02C2:  GOTO   2C1
02C3:  MOVF   1E,W
02C4:  MOVWF  6D
....................       // Uprav parametry menice 
....................       if (uclanku>105) 
02C5:  MOVF   6D,W
02C6:  SUBLW  69
02C7:  BTFSC  03.0
02C8:  GOTO   2CB
....................       { 
....................          perioda++; 
02C9:  INCF   6B,F
....................       } 
....................       else 
02CA:  GOTO   2CC
....................       { 
....................          perioda--; 
02CB:  DECF   6B,F
....................       } 
....................       set_pwm1_duty(0);    // Zastav PWM, aby slo nastavit jinou frekvenci 
02CC:  CLRF   15
....................       setup_timer_2(T2_DIV_BY_1,perioda,1);    // perioda 
02CD:  MOVLW  00
02CE:  MOVWF  78
02CF:  IORLW  04
02D0:  MOVWF  12
02D1:  MOVF   6B,W
02D2:  BSF    03.5
02D3:  MOVWF  12
....................       set_pwm1_duty(DUTY2); // PWM pro zatizeni clanku pri jedne 500W zarovce 
02D4:  MOVLW  13
02D5:  BCF    03.5
02D6:  MOVWF  15
....................       delay_ms(100); 
02D7:  MOVLW  64
02D8:  MOVWF  6F
02D9:  CALL   048
....................    } 
02DA:  INCF   6A,F
02DB:  GOTO   2BC
....................    output_low(REFPWR); 
02DC:  BSF    03.5
02DD:  BCF    06.1
02DE:  BCF    03.5
02DF:  BCF    06.1
....................    // posli telemetrii 
....................    sprintf(AXstring,"p=%u r=%u u=%u", perioda, razeni, uclanku);  // Convert DATA to String. 
*
01E1:  CLRF   69
*
02E0:  MOVLW  40
02E1:  MOVWF  69
02E2:  MOVLW  70
02E3:  MOVWF  70
02E4:  CALL   095
02E5:  MOVLW  3D
02E6:  MOVWF  70
02E7:  CALL   095
02E8:  MOVF   6B,W
02E9:  MOVWF  6E
02EA:  MOVLW  1B
02EB:  MOVWF  6F
02EC:  CALL   0B2
02ED:  MOVLW  20
02EE:  MOVWF  70
02EF:  CALL   095
02F0:  MOVLW  72
02F1:  MOVWF  70
02F2:  CALL   095
02F3:  MOVLW  3D
02F4:  MOVWF  70
02F5:  CALL   095
02F6:  MOVF   6C,W
02F7:  MOVWF  6E
02F8:  MOVLW  1B
02F9:  MOVWF  6F
02FA:  CALL   0B2
02FB:  MOVLW  20
02FC:  MOVWF  70
02FD:  CALL   095
02FE:  MOVLW  75
02FF:  MOVWF  70
0300:  CALL   095
0301:  MOVLW  3D
0302:  MOVWF  70
0303:  CALL   095
0304:  MOVF   6D,W
0305:  MOVWF  6E
0306:  MOVLW  1B
0307:  MOVWF  6F
0308:  CALL   0B2
....................    SendPacket(&AXstring[0]); 
0309:  MOVLW  40
030A:  MOVWF  6E
030B:  GOTO   177
....................  
....................    delay_ms(13000);           // Pockame 14s 
030C:  MOVLW  34
030D:  MOVWF  6E
030E:  MOVLW  FA
030F:  MOVWF  6F
0310:  CALL   048
0311:  DECFSZ 6E,F
0312:  GOTO   30E
....................  
.................... // rozjezd 
....................    SSPSTAT = 0;                  // inicializace SPI jednotky 
0313:  BSF    03.5
0314:  CLRF   14
....................    SSPCON1 = 0x22;               // SPI OSC/64 
0315:  MOVLW  22
0316:  BCF    03.5
0317:  MOVWF  14
....................    MotorPattern=0x02;            // prvni data pro vyslani 
0318:  MOVLW  02
0319:  MOVWF  68
....................    SSPBUF=MotorPattern; 
031A:  MOVF   68,W
031B:  MOVWF  13
....................    enable_interrupts(global); 
031C:  MOVLW  C0
031D:  IORWF  0B,F
....................    enable_interrupts(INT_SSP);   // az budou vyslana, prijde interrupt od SSP 
031E:  BSF    03.5
031F:  BSF    0C.3
....................  
....................    for(n=0; n<=7; n++)     // razeni osmi rychlostnich stupnu 
0320:  BCF    03.5
0321:  CLRF   6A
0322:  MOVF   6A,W
0323:  SUBLW  07
0324:  BTFSS  03.0
0325:  GOTO   32F
....................    { 
....................       MotorPattern=Pattern[n]; 
0326:  MOVF   6A,W
0327:  CALL   037
0328:  MOVWF  78
0329:  MOVWF  68
....................       delay_ms(razeni);             // Pockej na dalsi razeni 
032A:  MOVF   6C,W
032B:  MOVWF  6F
032C:  CALL   048
....................    }; 
032D:  INCF   6A,F
032E:  GOTO   322
....................    SSPSTAT = 0; 
032F:  BSF    03.5
0330:  CLRF   14
....................    SSPCON1 = 0;                     // SPI stop 
0331:  BCF    03.5
0332:  CLRF   14
....................    disable_interrupts(INT_SSP);     // zastav preruseni od SSP 
0333:  BSF    03.5
0334:  BCF    0C.3
....................  
.................... // jedem co to da 
....................    output_high(MOTOR); 
0335:  BCF    06.2
0336:  BCF    03.5
0337:  BSF    06.2
....................  
.................... /* 
....................    if (TRUE)         // Venkovni jizda? 
....................    { 
....................       delay_ms(5000);                  // Venku muzeme jet 5s 
....................       set_pwm1_duty(0);                // Zastav menic 
.................... //      output_low(MOTOR);               // Zastav motor 
....................       while(TRUE) restart_wdt();       // Cekej porad 
....................    }; 
....................    delay_ms(3000);                  
.................... */ 
....................    delay_ms(1300);                  // Nemeli bysme jet dele nez 1,3s :-) 
0338:  MOVLW  0A
0339:  MOVWF  6E
033A:  MOVLW  82
033B:  MOVWF  6F
033C:  CALL   048
033D:  DECFSZ 6E,F
033E:  GOTO   33A
....................    output_low(MOTOR);               // Zastav motor 
033F:  BSF    03.5
0340:  BCF    06.2
0341:  BCF    03.5
0342:  BCF    06.2
....................                                     // Menic je stale zapnut a zatezuje clanky 
....................  
....................    while(TRUE);            // Cekej, dokud se neztrati svetlo, 
0343:  GOTO   343
....................                            // nebo prijde WatchDog 
....................  
.................... } 
0344:  SLEEP

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