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

📄 psmon.lst

📁 大量ADuc831的程序员代码
💻 LST
字号:
PSMON                                                                                                         PAGE 1

                       1    ;********************************************************************
                       2    ;
                       3    ; Author        : ADI - Apps            www.analog.com/MicroConverter
                       4    ;
                       5    ; Date          : May 2002
                       6    ;
                       7    ; File          : PSMon.asm
                       8    ;
                       9    ; Hardware      : ADuC831
                      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.63V) 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    $MOD831                         ; Use 8052&ADuC831 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 020060           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 C2B4             51            CLR    LED
004C 32               52            RETI                    ; return only when "all's well"
                      53    
                      54    ;====================================================================
                      55                                                           ; MAIN PROGRAM
0060                  56    ORG 0060h                       ; start program above interrupts
                      57    
0060                  58    MAIN:
PSMON                                                                                                         PAGE 2

                      59    
0060 75DFC1           60            MOV     PSMCON, #0C1H   ; enable PSM with 
                      61                                    ;  AVdd 4.63V threshold
                      62                                    ;  DVdd 4.63V threshold
0063 75A922           63            MOV     IEIP2, #22H     ; enable PSM interrupt
                      64                                    ; high priority for PSM interrupt
0066 D2AF             65            SETB    EA              ; enable interrupts
                      66    
0068                  67    FLASH:                          ; Main Routine would go here
0068 B2B4             68            CPL     LED             ; blink LED indicating norm operation
006A 12006F           69            CALL    DELAY           ; delay 100ms
006D 80F9             70            JMP     FLASH           ; loop
                      71    
                      72    ;____________________________________________________________________
                      73                                                             ; SUBROUTINE
                      74    
006F                  75    DELAY:                          ; delay 100ms
                      76    
006F 7FC8             77            MOV     R7,#200         ; 200 * 500us = 100ms
0071 7EE5             78    DLY1:   MOV     R6,#229         ; 229 * 2.17us = 500us
0073 DEFE             79            DJNZ    R6,$            ; sit here for 500us
0075 DFFA             80            DJNZ    R7,DLY1         ; repeat 200 times (100ms delay)
0077 22               81            RET
                      82    ;____________________________________________________________________
                      83    
                      84    END

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

ACC. . . . . . . . . . . . . . .  D ADDR  00E0H  PREDEFINED  
CHECK. . . . . . . . . . . . . .  C ADDR  0045H  
DELAY. . . . . . . . . . . . . .  C ADDR  006FH  
DLY1 . . . . . . . . . . . . . .  C ADDR  0071H  
EA . . . . . . . . . . . . . . .  B ADDR  00AFH  PREDEFINED  
FLASH. . . . . . . . . . . . . .  C ADDR  0068H  
IEIP2. . . . . . . . . . . . . .  D ADDR  00A9H  PREDEFINED  
LED. . . . . . . . . . . . . . .    NUMB  00B4H  
MAIN . . . . . . . . . . . . . .  C ADDR  0060H  
P3 . . . . . . . . . . . . . . .  D ADDR  00B0H  PREDEFINED  
PSMCON . . . . . . . . . . . . .  D ADDR  00DFH  PREDEFINED  

⌨️ 快捷键说明

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