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

📄 pdown.lst

📁 aduc842原程序代码 ad公司芯片应用笔记
💻 LST
字号:
PDOWN                                                                                                         PAGE 1

                       1    ;********************************************************************
                       2    ;
                       3    ; Author        : ADI - Apps            www.analog.com/MicroConverter
                       4    ;
                       5    ; Date          : October 2003
                       6    ;
                       7    ; File          : PDown.asm
                       8    ;
                       9    ; Hardware      : ADuC842/ADuC843
                      10    ;
                      11    ; Description   : Demonstrates a use of a timer interval counter to
                      12    ;               wake the ADuC842 out of Power down mode after a user
                      13    ;               specified Power down time.
                      14    ;
                      15    ;               The LED will, on power up, flash at 10Hz. After 5s
                      16    ;               the ADuC842 will enter power down mode (the LED will 
                      17    ;               stop flashing in the off position). 
                      18    ;               
                      19    ;               By pressing the external interrupt 0 button (INT0) or
                      20    ;               when the user specified time runs out (20s in this 
                      21    ;               example) the ADuC842 will wake up and continue 
                      22    ;               blinking as before for 5s before entering power down
                      23    ;               mode again.
                      24    ;
                      25    ;********************************************************************
                      26    
                      27    $MOD842                         ; Use 8052&ADuC832 predefined symbols
                      28    
  00B4                29    LED     EQU     P3.4            ; P3.4 drives red LED on eval board
                      30    
                      31    ;____________________________________________________________________
                      32                                                      ; BEGINNING OF CODE
----                  33    CSEG
                      34    
0000                  35    ORG 0000h
                      36    
0000 020060           37            JMP     MAIN            ; jump to main program
                      38    
                      39    
                      40    ;____________________________________________________________________
                      41                                        ; EXTERNAL INTERRUPT VECTOR SPACE
0003                  42    ORG 0003h       
0003 32               43            RETI
                      44    
                      45    ;____________________________________________________________________
                      46                                             ; TIC INTERRUPT VECTOR SPACE
0053                  47    ORG 0053h
0053 32               48            RETI
                      49    ;_____________________________________________________________________
                      50    
0060                  51    ORG 0060h
                      52    
0060                  53    MAIN:                   
0060 75A9A4           54            MOV     IEIP2, #0A4h    ; enable time interval interrupt
                      55            
0063 D288             56            SETB    IT0             ; INT0 edge triggered
0065 D2A8             57            SETB    EX0             ; enable INT0 (button on eval board)
0067 D2AF             58            SETB    EA              ; enable interrupts
PDOWN                                                                                                         PAGE 2

                      59    
0069 75A614           60            MOV     INTVAL, #14h    ; initialise intval to 20 
                      61                                    ;     => 20 unit delay
                      62    
006C 7F32             63    BLINK:  MOV     R7, #50       
                      64           
006E 740A             65    LOOP:   MOV     A, #010        ; Blink light 50 times at 10Hz =>5s
0070 120084           66            CALL    DELAY
0073 B2B4             67            CPL     LED
0075 DFF7             68            DJNZ    R7, LOOP
                      69    
0077 75A113           70            MOV     TIMECON, #13h  ; initialise timecon to 
                      71                                   ; -count in secs
                      72                                   ; -start all time counters     
                      73    
007A D2B4             74            SETB     LED            ; turn off light when in power down
007C 758722           75            MOV     PCON, #22h     ; power down the ADuC842
                      76                                   ; Execution stops here until the ADuC
                      77                                   ; is powered up again by either an 
                      78                                   ; external interrupt or a Time Interval
                      79                                   ; Interrupt (20s)
                      80                                   ; Note: if using external data mem 
                      81                                   ; make sure ALE remains toggling after
                      82                                   ; you power up again. i.e. PCON.4=0
                      83     
007F 75A112           84            MOV     TIMECON, #12h  ; disable TCEN to reset counter to 0
                      85                                   ; and to temporarily stop counter 
0082 80E8             86            JMP     BLINK
                      87            
                      88    
                      89    ;____________________________________________________________________
                      90                                                                  ; DELAY
0084                  91    DELAY:                                  ; Delays by 10ms * A
                      92                                            ; 10mSec based on 2.097152MHZ 
                      93                                            ; Core Clock 
                      94                                            ; i.e. default ADuC842 Clock
                      95    
0084 F8               96                    MOV     R0,A            ; Acc holds delay variable
0085 791B             97     DLY0:          MOV     R1,#01Bh        ; Set up delay loop0
0087 7AFF             98     DLY1:          MOV     R2,#0FFh        ; Set up delay loop1
0089 DAFE             99                    DJNZ    R2,$            ; Dec R2 until R2 is zero
008B D9FA            100                    DJNZ    R1,DLY1         ; Dec R1 & Jump DLY1 until R1 is 0
008D D8F6            101                    DJNZ    R0,DLY0         ; Dec R0 & Jump DLY0 until R0 is 0
008F 22              102                    RET                     ; Return from subroutine
                     103    
                     104    
                     105    ;____________________________________________________________________
                     106    
                     107    END

VERSION 1.2h ASSEMBLY COMPLETE, 0 ERRORS FOUND
PDOWN                                                                                                         PAGE 3

BLINK. . . . . . . . . . . . . .  C ADDR  006CH  
DELAY. . . . . . . . . . . . . .  C ADDR  0084H  
DLY0 . . . . . . . . . . . . . .  C ADDR  0085H  
DLY1 . . . . . . . . . . . . . .  C ADDR  0087H  
EA . . . . . . . . . . . . . . .  B ADDR  00AFH  PREDEFINED  
EX0. . . . . . . . . . . . . . .  B ADDR  00A8H  PREDEFINED  
IEIP2. . . . . . . . . . . . . .  D ADDR  00A9H  PREDEFINED  
INTVAL . . . . . . . . . . . . .  D ADDR  00A6H  PREDEFINED  
IT0. . . . . . . . . . . . . . .  B ADDR  0088H  PREDEFINED  
LED. . . . . . . . . . . . . . .    NUMB  00B4H  
LOOP . . . . . . . . . . . . . .  C ADDR  006EH  
MAIN . . . . . . . . . . . . . .  C ADDR  0060H  
P3 . . . . . . . . . . . . . . .  D ADDR  00B0H  PREDEFINED  
PCON . . . . . . . . . . . . . .  D ADDR  0087H  PREDEFINED  
TIMECON. . . . . . . . . . . . .  D ADDR  00A1H  PREDEFINED  

⌨️ 快捷键说明

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