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

📄 part3.lst

📁 STH11和PIC单片机汇编语言-源程序
💻 LST
📖 第 1 页 / 共 5 页
字号:
                      00829         dodigit 10000
00E6   3027               M         movlw   high(10000)
00E7   0097               M         movwf   shi
00E8   3010               M         movlw   low(10000)
00E9   0098               M         movwf   slo
00EA   210B               M         call    dosub
00EB   0819           00830         movf    digit,W
00EC   008F           00831         movwf   TXChar
00ED   206F           00832         call    SendAChar
                      00833         dodigit 1000
00EE   3003               M         movlw   high(1000)
00EF   0097               M         movwf   shi
MPASM 03.20 Released            PART3.ASM   10-24-2002  12:35:27         PAGE 17


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

00F0   30E8               M         movlw   low(1000)
00F1   0098               M         movwf   slo
00F2   210B               M         call    dosub
00F3   0819           00834         movf    digit,W
00F4   008F           00835         movwf   TXChar
00F5   206F           00836         call    SendAChar
                      00837         dodigit 100
00F6   3000               M         movlw   high(100)
00F7   0097               M         movwf   shi
00F8   3064               M         movlw   low(100)
00F9   0098               M         movwf   slo
00FA   210B               M         call    dosub
00FB   0819           00838         movf    digit,W
00FC   008F           00839         movwf   TXChar
00FD   206F           00840         call    SendAChar
                      00841         dodigit 10
00FE   3000               M         movlw   high(10)
00FF   0097               M         movwf   shi
0100   300A               M         movlw   low(10)
0101   0098               M         movwf   slo
0102   210B               M         call    dosub
0103   0819           00842         movf    digit,W
0104   008F           00843         movwf   TXChar
0105   206F           00844         call    SendAChar
0106   0816           00845         movf    lo,w            ; ls byte is already correct
0107   3E30           00846         addlw   '0'             ; convert to ascii
0108   008F           00847         movwf   TXChar
0109   206F           00848         call    SendAChar
010A   0008           00849         return                  ; done
                      00850 
                      00851 ; "dosub" is called by the "dodigit" macro defined above.
                      00852 ; Subtract the number in shi/slo from hi/lo until the result
                      00853 ; is negative, incrementing the ascii equivelent each time.
                      00854 
010B   302F           00855 dosub   movlw   '0'-1
010C   0099           00856         movwf   digit
010D   0A99           00857 moresub incf    digit,F         ; increment ASCII character
010E   0818           00858         movf    slo,w           ; subtract current power of 10
010F   0296           00859         subwf   lo,f
0110   0817           00860         movf    shi,w
0111   1C03           00861         btfss   STATUS,C
0112   3E01           00862         addlw   1
0113   0295           00863         subwf   hi,f
0114   1803           00864         btfsc   STATUS,C        ; any carry?
0115   290D           00865         goto    moresub         ; no, keep subtracting
                      00866 
0116   0818           00867         movf    slo,w           ; reverse the last subtraction
0117   0796           00868         addwf   lo,f
0118   0817           00869         movf    shi,w
0119   1803           00870         btfsc   STATUS,C
011A   3E01           00871         addlw   1
011B   0795           00872         addwf   hi,f
011C   0008           00873         return
MPASM 03.20 Released            PART3.ASM   10-24-2002  12:35:27         PAGE 18


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

                      00874 
                      00875 ;------end SendAsciiNum----------------------------------------------
                      00876 
                      00877 ;------begin ReportVersion-------------------------------------------
                      00878 
                      00879 ; send a string with the version in it. The string comes from EEPROM
                      00880 ; memory and is null-terminated. The null terminator is not sent. The
                      00881 ; protocol dictates that the string sent is terminated by a CR, which
                      00882 ; is sent. This subroutine is called when the 'v' command is received.
                      00883 
011D                  00884 ReportVersion
011D   1283           00885         bcf     STATUS,RP0
011E   0189           00886         clrf    EEADR           ;the string we want starts at the 
                      00887                                 ;beginning of EEPROM memory.
                      00888 
011F                  00889 GetNextVersionChar
011F   1683           00890         bsf     STATUS,RP0
Message[302]: Register in operand not in bank 0.  Ensure that bank bits are correct.
0120   1408           00891         bsf     EECON1,RD
0121   1283           00892         bcf     STATUS,RP0
0122   0808           00893         movf    EEDATA,W
0123   1903           00894         btfsc   STATUS,Z        ;if the character in W is null, don't
                      00895                                 ;send any more.
0124   2932           00896         goto    MainLoop
                      00897 
0125   008F           00898         movwf   TXChar
0126   206F           00899         call    SendAChar
0127   0A89           00900         incf    EEADR,F
0128   291F           00901         goto    GetNextVersionChar
                      00902 
                      00903 ;------end ReportVersion---------------------------------------------
                      00904 
                      00905 ;------begin Idle----------------------------------------------------
                      00906 ;
                      00907 ; Idle should be called whenever the chip is waiting for something
                      00908 ; to happen (waiting for a character to be sent or received, for
                      00909 ; example). Here it's not doing anything.
                      00910 
0129                  00911 Idle
0129   0008           00912         return
                      00913 
                      00914 ;------end Idle------------------------------------------------------
                      00915 
                      00916 ;------Main Program--------------------------------------------------
                      00917 
012A                  00918 Main
                      00919 
                      00920 ; set up the ports as inputs and outputs as needed.
                      00921 
012A   1683           00922         bsf     STATUS,RP0      ;switch to bank 1
012B   30FF           00923         movlw   0xFF
Message[302]: Register in operand not in bank 0.  Ensure that bank bits are correct.
012C   0086           00924         movwf   TRISB           ;make Port B input
MPASM 03.20 Released            PART3.ASM   10-24-2002  12:35:27         PAGE 19


LOC  OBJECT CODE     LINE SOURCE TEXT
  VALUE

012D   3000           00925         movlw   0x00
Message[302]: Register in operand not in bank 0.  Ensure that bank bits are correct.
012E   0085           00926         movwf   TRISA           ;make Port A output
012F   1283           00927         bcf     STATUS,RP0
                      00928 
0130   0185           00929         clrf    PORTA
                      00930 
0131   2010           00931         call    SerSetup        ;set up serial comm routines & int.
                      00932 
                      00933 ; this main program simply waits for characters to be received, then
                      00934 ; calls the handler for the command indicated by the received character.
                      00935 
0132                  00936 MainLoop
0132   206A           00937         call    GetAChar        ;wait for a character
                      00938 
0133   080E           00939         movf    RXBuff,W        ;move the rx char into W
0134   3C74           00940         sublw   't'             ;compare with 't' character
0135   1903           00941         btfsc   STATUS,Z
0136   28D7           00942         goto    TellTemperature ;if t, report the temperature
                      00943 
0137   080E           00944         movf    RXBuff,W        ;move the rx char into W
0138   3C68           00945         sublw   'h'             ;compare with 'h' character
0139   1903           00946         btfsc   STATUS,Z
013A   28DB           00947         goto    TellHumidity    ;if h, report the humidity
                      00948 
013B   080E           00949         movf    RXBuff,W        ;move the rx char into W
013C   3C76           00950         sublw   'v'             ;compare with 'v' character
013D   1903           00951         btfsc   STATUS,Z
013E   291D           00952         goto    ReportVersion   ;if v, report the version number
                      00953 
013F   2932           00954         goto    MainLoop
                      00955 
                      00956 ;------Version EEPROM------------------------------------------------
                      00957 
2100                  00958         org     0x2100
2100   0057 0078 0050 00959         de      "WxPIC v0.3b (c) 2002 by NK0E",0x0D,0x0A,0x00   ; Version 0.3b
       0049 0043 0020 
       0076 0030 002E 
       0033 0062 0020 
       0028 0063 0029 
       0020 0032 0030 
       0030 0032 0020 
       0062 0079 0020 
       004E 004B 0030 
       0045 000D 000A 
       0000 
                      00960         end
MPASM 03.20 Released            PART3.ASM   10-24-2002  12:35:27         PAGE 20


SYMBOL TABLE
  LABEL                             VALUE 

BitCount                          0000000C
C                                 00000000
DC                                00000001
DoBit                             0000002D
Done                              0000005A
EEADR                             00000009
EECON1                            00000088
EECON2                            00000089
EEDATA                            00000008
EEIE                              00000006
EEIF                              00000004
EndDoBit                          0000004E
F                                 00000001
FSR                               00000004
GIE                               00000007
GetAChar                          0000006A
GetNextVersionChar                0000011F
GetStopBit                        00000039
INDF                              00000000
INTCON                            0000000B
INTE                              00000004
INTEDG                            00000006
INTF                              00000001
IRP                               00000007
Idle                              00000129
Int                               00000004
MSDelay                           0000001A
Main                              0000012A
MainLoop                          00000132
NOT_PD                            00000003
NOT_RBPU                          00000007
NOT_TO                            00000004
OPTION_REG                        00000081
PCL                               00000002
PCLATH                            0000000A
PORTA                             00000005
PORTB                             00000006
PS0                               00000000
PS1                               00000001
PS2                               00000002
PSA                               00000003
RBIE                              00000003
RBIF             

⌨️ 快捷键说明

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