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

📄 psmon.lst

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

                       1    ;********************************************************************
                       2    ;
                       3    ; Author        : ADI - Apps            www.analog.com/MicroConverter
                       4    ;
                       5    ; Date          : October 2003
                       6    ;
                       7    ; File          : PSMonS.asm
                       8    ;
                       9    ; Hardware      : ADuC842/ADuC843
                      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    $MOD842
                      25    
  00B4                26    LED     EQU     P3.4            ; P3.4 drives red LED on eval board
                      27    
                      28    ;____________________________________________________________________
                      29                                                      ; BEGINNING OF CODE
----                  30    CSEG
                      31    
0000                  32    ORG 0000h
                      33    
0000 020060           34            JMP     MAIN            ; jump to main program
                      35    ;____________________________________________________________________
                      36                                                 ; INTERRUPT VECTOR SPACE
0043                  37    ORG 0043h ;  (PSM ISR)
                      38    
0043 D2B4             39            SETB     LED             ; turn off the LED to indicate fault
                      40    
                      41    ; most often, a routine would here be called to store critical values
                      42    ; in user Flash/EE space and wait in a "safe" state of code execution
                      43    ; until the PSM interrupt bit becomes zero indicating that adequate
                      44    ; power supply voltage has returned.
                      45    
0045 E5DF             46    CHECK:  MOV     A,PSMCON        ; PSMCON.5 is the PSM interrupt bit..
0047 20E5FB           47            JB      ACC.5,CHECK     ; ..it is cleared only when Vdd has
                      48                                    ; remained above the trip point for
                      49                                    ; 256ms or more.
004A 32               50            RETI                    ; return only when "all's well"
                      51    
                      52    ;====================================================================
                      53                                                           ; MAIN PROGRAM
0060                  54    ORG 0060h                       ; start program above interrupts
                      55    
0060                  56    MAIN:
                      57    
0060 75DF41           58            MOV     PSMCON, #041H   ; enable PSM with 
PSMON                                                                                                         PAGE 2

                      59                                    ;  Vdd 4.63V threshold
0063 75A922           60            MOV     IEIP2, #22H     ; enable PSM interrupt
                      61                                    ; high priority for PSM interrupt
0066 D2AF             62            SETB    EA              ; enable interrupts
0068 740A             63            MOV     A,#10
006A                  64    FLASH:                          ; Main Routine would go here
006A B2B4             65            CPL     LED             ; blink LED indicating norm operation
006C 120071           66            CALL    DELAY           ; delay 100ms
006F 80F9             67            JMP     FLASH           ; loop
                      68    
                      69    ;____________________________________________________________________
                      70                                                             ; SUBROUTINE
                      71                                                            ; 10ms DELAY
0071                  72    DELAY:                                  ; Delays by 100ms 
                      73                                            ; 10mSec based on 2.097152MHZ 
                      74                                            ; Core Clock 
                      75                                            ; i.e. default ADuC842 Clock
                      76    
0071 F9               77                    MOV     R1,A            
0072 7A1B             78     DLY0:          MOV     R2,#01Bh        ; Set up delay loop0
0074 7BFF             79     DLY1:          MOV     R3,#0FFh        ; Set up delay loop1
0076 DBFE             80                    DJNZ    R3,$            ; Dec R3 & Jump here until R3 is 0
0078 DAFA             81                    DJNZ    R2,DLY1         ; Dec R2 & Jump DLY1 until R2 is 0
007A D9F6             82                    DJNZ    R1,DLY0
007C 22               83                    RET                     ; Return from subroutine
                      84    
                      85    ;____________________________________________________________________
                      86    
                      87    END

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

ACC. . . . . . . . . . . . . . .  D ADDR  00E0H  PREDEFINED  
CHECK. . . . . . . . . . . . . .  C ADDR  0045H  
DELAY. . . . . . . . . . . . . .  C ADDR  0071H  
DLY0 . . . . . . . . . . . . . .  C ADDR  0072H  
DLY1 . . . . . . . . . . . . . .  C ADDR  0074H  
EA . . . . . . . . . . . . . . .  B ADDR  00AFH  PREDEFINED  
FLASH. . . . . . . . . . . . . .  C ADDR  006AH  
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 + -