⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 base1.lst

📁 代码保护功能处于持续发展中。Microchip 承诺将不断改进产品的代码保护功能。任何试图破坏Microchip 代码保护功能的行为均可视 为违反了《数字器件千年版权法案(Digital Mille
💻 LST
📖 第 1 页 / 共 5 页
字号:
0125   0094           00044         MOVWF   SSPCON          ; Set mode & disable
0126   118C           00045         BCF     PIR1,SSPIF      ; clear interrupt flag
                      00046 
                      00047 ; Initialise TIMER0 for write delay ---------------------
                      00048 
0127   1683 1303      00049         BANKSEL OPTION_REG      ; 
0129   30C5           00050         MOVLW   B'11000101'     ; TIMER0 setup code
Message[302]: Register in operand not in bank 0.  Ensure that bank bits are correct.
012A   0081           00051         MOVWF   OPTION_REG      ; Internal clock,1/64
012B   1283 1303      00052         BANKSEL TMR0
012D   0008           00053         RETURN
                      00054 
                      00055 
                      00056 ; MAIN ROUTINES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                      00057 
MPASM 03.70.01 Released                             BASE1.ASM   3-28-2006  19:32:15         PAGE 13


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00058 ; Write a test byte to given address ;;;;;;;;;;;;;;;;;;;;
                      00059 
012E                  00060 writmem 
012E   0000           00061         NOP                     ; Setup
012F   1683 1303      00062         BANKSEL TRISC           ; port
0131   30FF           00063         MOVLW   b'11111111'     ; for
Message[302]: Register in operand not in bank 0.  Ensure that bank bits are correct.
0132   0087           00064         MOVWF   TRISC           ; SSP
0133   1283 1303      00065         BANKSEL PORTC           ; operation
0135   1694           00066         BSF     SSPCON,SSPEN    ; Enable serial port
                      00067         
0136   30A0           00068         MOVLW   0xA0            ; Control byte for WRITE
0137   00E4           00069         MOVWF   ConReg          ; Load it
0138   2160           00070         CALL    sencon          ; write control byte
0139   216C           00071         CALL    senadd          ; write address bytes
013A   2174           00072         CALL    sendat          ; write data byte
013B   2177           00073         CALL    senstop         ; write stop bit
013C   2184           00074         CALL    waitm           ; Wait 10ms for write
                      00075 
013D   1294           00076         BCF     SSPCON,SSPEN    ; Disable serial port   
013E   0008           00077         RETURN
                      00078 
                      00079 
                      00080 ; Read the byte from given address ;;;;;;;;;;;;;;;;;;;;;;
                      00081 
013F                  00082 readmem
013F   0000           00083         NOP                     ; Setup
0140   1683 1303      00084         BANKSEL TRISC           ; port
0142   30FF           00085         MOVLW   b'11111111'     ; for
Message[302]: Register in operand not in bank 0.  Ensure that bank bits are correct.
0143   0087           00086         MOVWF   TRISC           ; SSP
0144   1283 1303      00087         BANKSEL PORTC           ; operation
0146   1694           00088         BSF     SSPCON,SSPEN    ; Enable serial port
                      00089 
0147   30A0           00090         MOVLW   0xA0            ; Control byte to WRITE
0148   00E4           00091         MOVWF   ConReg          ; address to memory
0149   2160           00092         CALL    sencon          ; write control byte
014A   216C           00093         CALL    senadd          ; write address bytes
014B   2177           00094         CALL    senstop         ; Stop
                      00095 
014C   30A1           00096         MOVLW   0xA1            ; Control byte to READ
014D   00E4           00097         MOVWF   ConReg          ; data from memory
014E   2160           00098         CALL    sencon          ; write control byte
014F   1683 1303      00099         BANKSEL SSPCON2
Message[302]: Register in operand not in bank 0.  Ensure that bank bits are correct.
0151   1591           00100         BSF     SSPCON2,RCEN    ; Enable receive mode
Message[302]: Register in operand not in bank 0.  Ensure that bank bits are correct.
0152   1C14           00101 war     BTFSS   SSPSTAT,BF      ; Check ...
0153   2952           00102         GOTO    war             ; for read done
0154   217D           00103         CALL    senack          ; write NOT acknowledge
0155   2177           00104         CALL    senstop         ; write stop bit
                      00105 
0156   0813           00106         MOVF    SSPBUF,W        ; Read receive buffer
MPASM 03.70.01 Released                             BASE1.ASM   3-28-2006  19:32:15         PAGE 14


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

0157   00E3           00107         MOVWF   RecReg          ; and store it
0158   1294           00108         BCF     SSPCON,SSPEN    ; Disable serial port
0159   0008           00109         RETURN
                      00110 
                      00111 
                      00112 ; SUBROUTINES ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                      00113 
                      00114 ; Load buffer for write to memory -----------------------
                      00115         
015A   0000           00116 writem  NOP                     ; Select.. 
015B   1283 1303      00117         BANKSEL SSPBUF          ; .. bank
015D   0093           00118         MOVWF   SSPBUF          ; write address/data
015E   2191           00119         CALL    wint            ; Wait until sent
015F   0008           00120         RETURN                  ; done
                      00121 
                      00122 ; Routines to write, start, control, address, data, stop
                      00123 
0160   0000           00124 sencon  NOP                     ; GENERATE START BIT
0161   1283 1303      00125         BANKSEL PIR1
0163   118C           00126         BCF     PIR1,SSPIF      ; Clear interrupt flag
0164   1683 1303      00127         BANKSEL SSPCON2         ; select register page
Message[302]: Register in operand not in bank 0.  Ensure that bank bits are correct.
0166   1711           00128         BSF     SSPCON2,ACKSTAT ; Set acknowledge flag
Message[302]: Register in operand not in bank 0.  Ensure that bank bits are correct.
0167   1411           00129         BSF     SSPCON2,SEN     ; Generate start bit
0168   2191           00130         CALL    wint            ; wait till done
0169   0864           00131         MOVF    ConReg,W        ; write CONTROL BYTE
016A   215A           00132         CALL    writem          ; Memory ID & address
016B   0008           00133         RETURN                  ; done
                      00134 
                      00135 ; Write address to memory -------------------------------
                      00136 
016C   0000           00137 senadd  NOP
016D   1283 1303      00138         BANKSEL SSPCON          ; writem ADDRESS BYTES
016F   0861           00139         MOVF    HiReg,W         ; load address high byte
0170   215A           00140         CALL    writem          ; and write
0171   0862           00141         MOVF    LoReg,W         ; load address low byte
0172   215A           00142         CALL    writem          ; and write
0173   0008           00143         RETURN
                      00144 
                      00145 ; Write data to memeory ---------------------------------
                      00146 
0174   0860           00147 sendat  MOVF    SenReg,W        ; Load data
0175   215A           00148         CALL    writem          ; and write
0176   0008           00149         RETURN                  ; done  
                      00150 
                      00151 ; Genearte stop bit -------------------------------------
                      00152 
0177   0000           00153 senstop NOP
0178   1683 1303      00154         BANKSEL SSPCON2         ; GENERATE STOP BIT
Message[302]: Register in operand not in bank 0.  Ensure that bank bits are correct.
017A   1511           00155         BSF     SSPCON2,PEN     ; Generate stop bit
017B   2191           00156         CALL    wint            ; wait till done
MPASM 03.70.01 Released                             BASE1.ASM   3-28-2006  19:32:15         PAGE 15


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

017C   0008           00157         RETURN                  ; done
                      00158 
                      00159 ; Generate acknowledge ---------------------------------- 
                      00160 
017D   0000           00161 senack  NOP
017E   1683 1303      00162         BANKSEL SSPCON2
Message[302]: Register in operand not in bank 0.  Ensure that bank bits are correct.
0180   1691           00163         BSF     SSPCON2,ACKDT   ; Set ack. bit high
Message[302]: Register in operand not in bank 0.  Ensure that bank bits are correct.
0181   1611           00164         BSF     SSPCON2,ACKEN   ; Initiate ack.sequence
0182   2191           00165         CALL    wint            ; Wait for ack. done
0183   0008           00166         RETURN                  ; done
                      00167 
                      00168 ; Wait for write to finish ------------------------------
                      00169 
0184   0000           00170 waitm   NOP
0185   1283 1303      00171         BANKSEL TMR0            ; WAIT FOR WRITE DONE
0187   309C           00172         MOVLW   d'156'          ; Set starting value
0188   0081           00173         MOVWF   TMR0            ; and load into timer
0189   1283 1303      00174         BANKSEL INTCON          ; 64 x 156us = 10ms
018B   110B           00175         BCF     INTCON,T0IF     ; Reset timer out flag
018C   1D0B           00176 wem     BTFSS   INTCON,T0IF     ; Wait 10ms 
018D   298C           00177         GOTO    wem             ; for timeout
018E   1283 1303      00178         BANKSEL TMR0            ; default bank
0190   0008           00179         RETURN                  ; Byte write done....
                      00180 
                      00181 ; Wait for interrupt flag SSPIF for writem/recive done --
                      00182  
0191   0000           00183 wint    NOP                     ; BANKSEL has no address
0192   1283 1303      00184         BANKSEL PIR1            ; Select bank 
0194   118C           00185         BCF     PIR1,SSPIF      ; reset interrupt flag
0195   0000           00186 win     NOP
0196   1D8C           00187         BTFSS   PIR1,SSPIF      ; wait for.. 
0197   2995           00188         GOTO    win             ; ..transmit done
0198   0008           00189         RETURN                  ; done
                      00190 
                      00191 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
                      00326 ;
                      00327 ;----------------------------------------------------------
                      00328         END                     ; of source code
MPASM 03.70.01 Released                             BASE1.ASM   3-28-2006  19:32:15         PAGE 16


SYMBOL TABLE
  LABEL                             VALUE 

ACKDT                             00000005
ACKEN                             00000004
ACKSTAT                           00000006
ADCON0                            0000001F
ADCON1                            0000009F
ADCS0                             00000006
ADCS1                             00000007
ADDEN                             00000003
ADFM                              00000007
ADIE                              00000006
ADIF                              00000006
ADON                              00000000
ADRESH                            0000001E
ADRESL                            0000009E
ADbin                             00000077
ADcon                             00000021
BCLIE                             00000003
BCLIF                             00000003
BF                                00000000
BRGH                              00000002
C                                 00000000
C1INV                             00000004
C1OUT                             00000006
C2INV                             00000005
C2OUT                             00000007
CCP1CON                           00000017
CCP1IE                            00000002
CCP1IF                            00000002
CCP1M0                            00000000
CCP1M1                            00000001
CCP1M2                            00000002
CCP1M3                            00000003
CCP1X                             00000005
CCP1Y                             00000004
CCP2CON                           0000001D
CCP2IE                            00000000
CCP2IF                            00000000
CCP2M0                            00000000
CCP2M1                            00000001
CCP2M2                            00000002
CCP2M3                            00000003
CCP2X                             00000005
CCP2Y                             00000004
CCPR1H                            00000016
CCPR1L                            00000015
CCPR2H                            0000001C

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -