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

📄 psmon.lst

📁 aduc812的汇编例子
💻 LST
字号:
PSMON                                                                                                         PAGE 1

                       1    ;********************************************************************
                       2    ;
                       3    ; Author        : ADI - Apps            www.analog.com/MicroConverter
                       4    ;
                       5    ; Date          : 28 May 1999
                       6    ;
                       7    ; File          : PSMon.asm
                       8    ;
                       9    ; Hardware      : ADuC812
                      10    ;
                      11    ; Description   : Demonstrates use of on-chip power supply monitor.
                      12    ;                 In normal operation, this code flashes the LED at
                      13    ;                 approximately 5Hz.  when Vdd drops below the user
                      14    ;                 specified trip-point (here 4.37V) the PSM interrupt
                      15    ;                 is executed.  once inside this interrupt service
                      16    ;                 routine, this code waits until the PSM interrupt
                      17    ;                 bit becomes zero again, indicating that the power
                      18    ;                 supply is again above the trip point and has been
                      19    ;                 there for at least 256ms.  at this point, a RETI
                      20    ;                 instruction is executed, and normal code execution
                      21    ;                 is resumed, indicated by the flashing LED.
                      22    ;
                      23    ;********************************************************************
                      24    
                      25    $MOD812                         ; Use 8052&ADuC812 predefined symbols
                      26    
  00B4                27    LED     EQU     P3.4            ; P3.4 drives red LED on eval board
                      28    
                      29    ;____________________________________________________________________
                      30                                                      ; BEGINNING OF CODE
----                  31    CSEG
                      32    
0000                  33    ORG 0000h
                      34    
0000 02004B           35            JMP     MAIN            ; jump to main program
                      36    ;____________________________________________________________________
                      37                                                 ; INTERRUPT VECTOR SPACE
0043                  38    ORG 0043h ;  (PSM ISR)
                      39    
0043 D2B4             40            SETB     LED             ; turn off the LED to indicate fault
                      41    
                      42    ; most often, a routine would here be called to store critical values
                      43    ; in user Flash/EE space and wait in a "safe" state of code execution
                      44    ; until the PSM interrupt bit becomes zero indicating that adequate
                      45    ; power supply voltage has returned.
                      46    
0045 E5DF             47    CHECK:  MOV     A,PSMCON        ; PSMCON.5 is the PSM interrupt bit..
0047 20E5FB           48            JB      ACC.5,CHECK     ; ..it is cleared only when Vdd has
                      49                                    ; remained above the trip point for
                      50                                    ; 256ms or more.
004A 32               51            RETI                    ; return only when "all's well"
                      52    
                      53    ;====================================================================
                      54                                                           ; MAIN PROGRAM
004B                  55    ORG 004Bh
                      56    
004B                  57    MAIN:
                      58    
PSMON                                                                                                         PAGE 2

004B 75DF05           59            MOV     PSMCON,#005h    ; enable PSM with 4.37V threshold
004E D2AF             60            SETB    EA              ; enable interrupts
0050 75A902           61            MOV     IE2,#002h       ; enable PSM interrupt
                      62    
0053 B2B4             63    FLASH:  CPL     LED             ; blink LED indicating norm operation
0055 12005A           64            CALL    DELAY           ; delay 100ms
0058 80F9             65            JMP     FLASH           ; loop
                      66    
                      67    ;____________________________________________________________________
                      68                                                             ; SUBROUTINE
                      69    
005A                  70    DELAY:                          ; delay 100ms
                      71    
005A 7FC8             72            MOV     R7,#200         ; 200 * 500us = 100ms
005C 7EE5             73    DLY1:   MOV     R6,#229         ; 229 * 2.17us = 500us
005E DEFE             74            DJNZ    R6,$            ; sit here for 500us
0060 DFFA             75            DJNZ    R7,DLY1         ; repeat 200 times (100ms total)
0062 22               76            RET
                      77    
                      78    ;____________________________________________________________________
                      79    
                      80    END

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

ACC. . . . . . . . . . . . . . .  D ADDR  00E0H  PREDEFINED  
CHECK. . . . . . . . . . . . . .  C ADDR  0045H  
DELAY. . . . . . . . . . . . . .  C ADDR  005AH  
DLY1 . . . . . . . . . . . . . .  C ADDR  005CH  
EA . . . . . . . . . . . . . . .  B ADDR  00AFH  PREDEFINED  
FLASH. . . . . . . . . . . . . .  C ADDR  0053H  
IE2. . . . . . . . . . . . . . .  D ADDR  00A9H  PREDEFINED  
LED. . . . . . . . . . . . . . .    NUMB  00B4H  
MAIN . . . . . . . . . . . . . .  C ADDR  004BH  
P3 . . . . . . . . . . . . . . .  D ADDR  00B0H  PREDEFINED  
PSMCON . . . . . . . . . . . . .  D ADDR  00DFH  PREDEFINED  

⌨️ 快捷键说明

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