📄 psmons.lst
字号:
PSMONS PAGE 1
1 ;********************************************************************
2 ;
3 ; Author : ADI - Apps www.analog.com/MicroConverter
4 ;
5 ; Date : 12 February 2001
6 ;
7 ; File : PSMonS.asm
8 ;
9 ; Hardware : ADuC814
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 $MOD814
25
00B3 26 LED EQU P3.3 ; P3.3 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 C2B3 39 CLR 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
PSMONS 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
63
0068 64 FLASH: ; Main Routine would go here
0068 B2B3 65 CPL LED ; blink LED indicating norm operation
006A 12006F 66 CALL DELAY ; delay 100ms
006D 80F9 67 JMP FLASH ; loop
68
69 ;____________________________________________________________________
70 ; SUBROUTINE
71 ; 100ms DELAY
006F 72 DELAY: ; Delays by 100ms * A
73 ; 100mSec based on 2.097152MHZ
74 ; Core Clock
75 ; i.e. default ADuC814 Clock
76
77
006F 7A22 78 MOV R2,#022h ; Set up delay loop0
0071 7BFF 79 DLY1: MOV R3,#0FFh ; Set up delay loop1
0073 DBFE 80 DJNZ R3,$ ; Dec R3 & Jump here until R3 is 0
0075 DAFA 81 DJNZ R2,DLY1 ; Dec R2 & Jump DLY1 until R2 is 0
0077 22 82 RET ; Return from subroutine
83
84 ;____________________________________________________________________
85
86 END
VERSION 1.2h ASSEMBLY COMPLETE, 0 ERRORS FOUND
PSMONS 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 00B3H
MAIN . . . . . . . . . . . . . . C ADDR 0060H
P3 . . . . . . . . . . . . . . . D ADDR 00B0H PREDEFINED
PSMCON . . . . . . . . . . . . . D ADDR 00DFH PREDEFINED
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -