Subversion Repositories svnkaklik

Rev

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

CCS PCM C Compiler, Version 3.221, 27853               18-IX-05 23:22

               Filename: C:\PIC\jumpk\menic.LST

               ROM used: 328 words (8%)
                         Largest free fragment is 2048
               RAM used: 21 (12%) at main() level
                         21 (12%) worst case
               Stack:    2 worst case (1 in main + 1 for interrupts)

*
0000:  MOVLW  00
0001:  MOVWF  0A
0002:  GOTO   05F
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
....................  //----------------------------  
.................... // Sagitta - 9. 9. 2005  
.................... //----------------------------  
....................   
.................... #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, \  
....................          NODEBUG, NOPROTECT, NOFCMEN, NOIESO, CCPB3  
....................   
.................... #use delay(clock=4000000, RESTART_WDT)  
*
0048:  MOVLW  2F
0049:  MOVWF  04
004A:  MOVF   00,W
004B:  BTFSC  03.2
004C:  GOTO   05E
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  4A
0057:  MOVWF  77
0058:  DECFSZ 77,F
0059:  GOTO   058
005A:  NOP
005B:  CLRWDT
005C:  DECFSZ 00,F
005D:  GOTO   04D
005E:  RETLW  00
....................   
....................  
....................   
.................... #define RAZENI    55    // Po kolika ms se bude menit rychlost pri rozjizdeni  
.................... #define REFSTART  120   // Hodnota komparatoru odpovidajici 1,7V pri  
....................                         // nezatizenych solarnich clancich  
.................... #define DUTY1     2     // Delka sepnuti PWM v us pro sero  
.................... #define DUTY2     20    // Delka sepnuti PWM v us pro jednu zarovku 500W  
....................   
.................... // Tabulka napeti vuci referencni LED (cca 1,7V)  
.................... // hodnota prevodniku / napeti na clancich  
.................... // 250   1,6V  
.................... // 200   2,1V  
.................... // 150   2,8V  
.................... // 145   2,9V  
.................... // 120   3,6V  
.................... // 110   4,0V  
....................   
.................... #define MENIC  PIN_B3   // Spinani tranzistoru menice  
.................... #define REFPWR PIN_B1   // Napajeni zdroje referencniho napeti  
.................... #define MOTOR  PIN_B2   // Spinani tranzistoru motoru  
....................   
.................... #byte SSPBUF   = 0x13   // Registry 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()     // Vyvola se po odeslani znaku pres SSP  
.................... {  
....................    SSPBUF=MotorPattern;       // znovu vysli stejnou hodnotu  
*
0043:  MOVF   29,W
0044:  MOVWF  13
.................... }  
....................   
0045:  BCF    0C.3
0046:  BCF    0A.3
0047:  GOTO   022
.................... void main()  
.................... {  
*
005F:  CLRF   04
0060:  MOVLW  1F
0061:  ANDWF  03,F
0062:  BSF    03.5
0063:  BCF    1F.4
0064:  BCF    1F.5
0065:  MOVF   1B,W
0066:  ANDLW  80
0067:  MOVWF  1B
0068:  MOVLW  07
0069:  MOVWF  1C
006A:  MOVF   1C,W
006B:  BCF    03.5
006C:  BCF    0D.6
006D:  MOVLW  60
006E:  BSF    03.5
006F:  MOVWF  0F
....................    int8 n;  
....................    int8 cekej;  
....................    int8 perioda;  
....................    int8 rozjezd;  
....................   
....................    // Inicializace casovacu a prevodniku  
....................    setup_timer_0(RTCC_INTERNAL);setup_wdt(WDT_1152MS);  
0070:  MOVF   01,W
0071:  ANDLW  C0
0072:  MOVWF  01
0073:  MOVLW  0E
0074:  MOVWF  77
0075:  MOVLW  07
0076:  BCF    03.5
0077:  CLRF   01
0078:  MOVLW  81
0079:  MOVWF  04
007A:  MOVF   00,W
007B:  ANDLW  F0
007C:  IORLW  07
007D:  MOVWF  00
007E:  CLRWDT
007F:  MOVF   00,W
0080:  ANDLW  F7
0081:  BTFSC  77.3
0082:  ANDLW  F0
0083:  IORWF  77,W
0084:  MOVWF  00
....................    setup_adc_ports(ADC_CLOCK_INTERNAL|sAN1|sAN4|VSS_VDD);  
0085:  BSF    03.5
0086:  BCF    1F.4
0087:  BCF    1F.5
0088:  MOVF   1B,W
0089:  ANDLW  80
008A:  IORLW  D2
008B:  MOVWF  1B
....................    setup_adc(ADC_CLOCK_INTERNAL);  
008C:  BCF    1F.6
008D:  BCF    03.5
008E:  BSF    1F.6
008F:  BSF    1F.7
0090:  BSF    03.5
0091:  BCF    1F.7
0092:  BCF    03.5
0093:  BSF    1F.0
....................    setup_spi(FALSE);  
0094:  BCF    14.5
0095:  BSF    03.5
0096:  BCF    06.2
0097:  BSF    06.1
0098:  BCF    06.4
0099:  MOVLW  00
009A:  BCF    03.5
009B:  MOVWF  14
009C:  BSF    03.5
009D:  MOVWF  14
....................    setup_timer_1(T1_DISABLED);  
009E:  BCF    03.5
009F:  CLRF   10
....................    setup_comparator(NC_NC_NC_NC);  
00A0:  MOVLW  07
00A1:  BSF    03.5
00A2:  MOVWF  1C
00A3:  MOVF   05,W
00A4:  CLRWDT
00A5:  MOVLW  02
00A6:  MOVWF  77
00A7:  DECFSZ 77,F
00A8:  GOTO   0A7
00A9:  NOP
00AA:  NOP
00AB:  MOVF   1C,W
00AC:  BCF    03.5
00AD:  BCF    0D.6
....................    setup_vref(FALSE);  
00AE:  BSF    03.5
00AF:  CLRF   1D
....................   
....................    output_low(MENIC);      // Vsechno zastav  
00B0:  BCF    06.3
00B1:  BCF    03.5
00B2:  BCF    06.3
....................    output_low(MOTOR);  
00B3:  BSF    03.5
00B4:  BCF    06.2
00B5:  BCF    03.5
00B6:  BCF    06.2
....................    output_low(REFPWR);  
00B7:  BSF    03.5
00B8:  BCF    06.1
00B9:  BCF    03.5
00BA:  BCF    06.1
....................   
....................    set_adc_channel(4);     // Vyber AD kanal pro pomerne mereni napeti  
00BB:  MOVLW  20
00BC:  MOVWF  78
00BD:  MOVF   1F,W
00BE:  ANDLW  C7
00BF:  IORWF  78,W
00C0:  MOVWF  1F
....................    set_pwm1_duty(0);       // Spust PWM, ale zatim s trvalou 0 na vystupu  
00C1:  CLRF   15
....................    setup_ccp1(CCP_PWM);             // PWM pro zatizeni clanku v seru  
00C2:  BSF    03.5
00C3:  BCF    06.3
00C4:  BCF    03.5
00C5:  BCF    06.3
00C6:  MOVLW  0C
00C7:  MOVWF  17
....................    setup_timer_2(T2_DIV_BY_1,100,1); // perioda PWM  
00C8:  MOVLW  00
00C9:  MOVWF  78
00CA:  IORLW  04
00CB:  MOVWF  12
00CC:  MOVLW  64
00CD:  BSF    03.5
00CE:  MOVWF  12
....................   
....................    setup_oscillator(OSC_4MHZ|OSC_INTRC); // rozjed PIC (zvysi se odber)  
00CF:  MOVLW  62
00D0:  MOVWF  0F
....................   
.................... // jsme v depu? 
....................    set_pwm1_duty(DUTY1);                     // delka sepnuti  
00D1:  MOVLW  02
00D2:  BCF    03.5
00D3:  MOVWF  15
....................    do  
....................    {  
....................       output_low(REFPWR);  
00D4:  BSF    03.5
00D5:  BCF    06.1
00D6:  BCF    03.5
00D7:  BCF    06.1
....................       delay_ms(100);  
00D8:  MOVLW  64
00D9:  MOVWF  2F
00DA:  CALL   048
....................       output_high(REFPWR);          // zapni napajeni napetove reference (LED)  
00DB:  BSF    03.5
00DC:  BCF    06.1
00DD:  BCF    03.5
00DE:  BSF    06.1
....................       delay_ms(20);  
00DF:  MOVLW  14
00E0:  MOVWF  2F
00E1:  CALL   048
....................    } while (read_adc()>REFSTART);   // Odkryl starter clanky? 
00E2:  BSF    1F.2
00E3:  BTFSC  1F.2
00E4:  GOTO   0E3
00E5:  MOVF   1E,W
00E6:  SUBLW  78
00E7:  BTFSS  03.0
00E8:  GOTO   0D4
....................    output_low(REFPWR);  
00E9:  BSF    03.5
00EA:  BCF    06.1
00EB:  BCF    03.5
00EC:  BCF    06.1
....................   
....................    // Precti trimr  
....................    set_adc_channel(1);           // Zjisteni nastaveni trimru PWM  
00ED:  MOVLW  08
00EE:  MOVWF  78
00EF:  MOVF   1F,W
00F0:  ANDLW  C7
00F1:  IORWF  78,W
00F2:  MOVWF  1F
....................    delay_us(100);                // Pockej na prepnuti kanalu A/D prevodniku  
00F3:  CLRWDT
00F4:  MOVLW  20
00F5:  MOVWF  77
00F6:  DECFSZ 77,F
00F7:  GOTO   0F6
00F8:  NOP
00F9:  NOP
....................    perioda=(read_adc()>>1)+40;   // rozsah: 40 az 167  
00FA:  BSF    1F.2
00FB:  BTFSC  1F.2
00FC:  GOTO   0FB
00FD:  MOVF   1E,W
00FE:  MOVWF  77
00FF:  BCF    03.0
0100:  RRF    77,F
0101:  MOVF   77,W
0102:  ADDLW  28
0103:  MOVWF  2C
....................    set_pwm1_duty(0);       // Zastav PWM, aby slo zmenit periodu  
0104:  CLRF   15
....................    setup_timer_2(T2_DIV_BY_1,perioda,1); // Zapis nastavenou periodu  
0105:  MOVLW  00
0106:  MOVWF  78
0107:  IORLW  04
0108:  MOVWF  12
0109:  MOVF   2C,W
010A:  BSF    03.5
010B:  MOVWF  12
....................   
.................... // nabíjíme  
....................    set_pwm1_duty(DUTY2);            // delka sepnuti PWM  
010C:  MOVLW  14
010D:  BCF    03.5
010E:  MOVWF  15
....................    delay_ms(12500);  
010F:  MOVLW  32
0110:  MOVWF  2E
0111:  MOVLW  FA
0112:  MOVWF  2F
0113:  CALL   048
0114:  DECFSZ 2E,F
0115:  GOTO   111
....................   
.................... // rozjezd  
....................    SSPSTAT = 0;                  // inicializace SPI jednotky  
0116:  BSF    03.5
0117:  CLRF   14
....................    SSPCON1 = 0x22;               // SPI OSC/64  
0118:  MOVLW  22
0119:  BCF    03.5
011A:  MOVWF  14
....................    MotorPattern=Pattern[0];  
011B:  MOVLW  02
011C:  MOVWF  29
....................    SSPBUF=MotorPattern;          // 1. data pro vyslani  
011D:  MOVF   29,W
011E:  MOVWF  13
....................    enable_interrupts(global);  
011F:  MOVLW  C0
0120:  IORWF  0B,F
....................    enable_interrupts(INT_SSP);   // az budou vyslana, prijde preruseni  
0121:  BSF    03.5
0122:  BSF    0C.3
....................   
....................    for(n=0; n<=7; n++)     // razeni osmi rychlostnich stupnu  
0123:  BCF    03.5
0124:  CLRF   2A
0125:  MOVF   2A,W
0126:  SUBLW  07
0127:  BTFSS  03.0
0128:  GOTO   132
....................    {  
....................       MotorPattern=Pattern[n];  
0129:  MOVF   2A,W
012A:  CALL   037
012B:  MOVWF  78
012C:  MOVWF  29
....................       delay_ms(RAZENI);             // Pockej na dalsi razeni  
012D:  MOVLW  37
012E:  MOVWF  2F
012F:  CALL   048
....................    };  
0130:  INCF   2A,F
0131:  GOTO   125
....................    SSPSTAT = 0;  
0132:  BSF    03.5
0133:  CLRF   14
....................    SSPCON1 = 0;                     // SPI stop  
0134:  BCF    03.5
0135:  CLRF   14
....................    disable_interrupts(INT_SSP);     // zastav preruseni od SSP  
0136:  BSF    03.5
0137:  BCF    0C.3
....................   
.................... // jedem co to da  
....................    output_high(MOTOR);  
0138:  BCF    06.2
0139:  BCF    03.5
013A:  BSF    06.2
....................    delay_ms(1300);         // dyl jak 1,3s bysme nemeli jet :)  
013B:  MOVLW  0A
013C:  MOVWF  2E
013D:  MOVLW  82
013E:  MOVWF  2F
013F:  CALL   048
0140:  DECFSZ 2E,F
0141:  GOTO   13D
....................    output_low(MOTOR);      // zastav motor  
0142:  BSF    03.5
0143:  BCF    06.2
0144:  BCF    03.5
0145:  BCF    06.2
....................                            // Menic je stale zapnut a zatezuje clanky  
....................   
....................    while(TRUE);            // Cekej, dokud se neztrati svetlo,  
0146:  GOTO   146
....................                            // nebo prijde WatchDog  
.................... }  
....................  
0147:  SLEEP

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