
VMX51C1020
_________________________________________________________________________________________________
www.ramtron.com
page 72 of 80
T
ABLE
124:
(PORTIRQSTAT)
P
ORT
C
HANGE
I
RQ
S
TATUS
-
SFR
A1
H
7
6
P17ISTAT
P16ISTAT
5
4
P15ISTAT
P14ISTAT
3
2
1
0
P13ISTAT
P12ISTAT
P11ISTAT
P10ISTAT
Bit
7
Mnemonic
P17ISTAT
Function
Port 1.7 changed
0 = No
1 = Yes
Port 1.6 changed
0 = No
1 = Yes
Port 1.5 changed
0 = No
1 = Yes
Port 1.4 changed
0 = No
1 = Yes
Port 1.3 changed
0 = No
1 = Yes
Port 1.2 changed
0 = No
1 = Yes
Port 1.1 changed
0 = No
1 = Yes
Port 1.0 changed
0 = No
1 = Yes
6
P16ISTAT
5
P15ISTAT
4
P14ISTAT
3
P13ISTAT
2
P12ISTAT
1
P11ISTAT
0
P10ISTAT
F
IGURE
44:
A
PPLICATION EXAMPLE OF
P
ORT CHANGE INTERRUPT
1
2
3
4
5
6
7
8
9
*
0
#
VMX51C1020
P1.7
P1.4
P1.5
P1.6
P1.3
P1.2
P1.1
Numeric Keypad
The following provides an assembler example
for configuration of the Interrupt on Port1 pin
change and how it is shared with the ADC
interrupt.
include VMIXreg.INC
;*** INTERRUPT VECTORS JUMP TABLE *
ORG 0000H
;BOOT ORIGIN VECTOR
LJMP
START
ORG 006BH
;INT ADC and P1 change interrupt
LJMP
INT_ADC_P1
;*** MAIN PROGRAM
ORG 0100h
START:
MOV
DIGPWREN,#01H
MOV
P2PINCFG,#0FFH
;*** Initialise Port change interrupt on P1.0 - P1.7
MOV
PORTIRQSTAT,#00H
MOV
PORTIRQEN,#11111111B
;*** Initialise the ADC, BGAP, PGA Operation
MOV
ANALOGPWREN,#07h
;Select CH0 as ADC input + Enable input buffer + Adc clk
MOV
INMUXCTRL,#0Fh
MOV
ADCCLKDIV,#0Fh
MOV
ADCCONVRLOW,#000h
;*** configure ADC Conversion Rate
MOV
ADCCONVRMED,#080h
MOV
ADCCONVRHIGH,#016h
MOV
ADCCTRL,#11111010b
;***Activate All interrupts + (serial port for debugger support)
MOV
IEN0,#090H
;*** Enable ADC interrupt
MOV
IEN1,#020H
;***Wait IRQ…
WAITIRQ: LJMP
WAITIRQ
ORG 0200h
;************************************************************************
;* IRQ ROUTINE: IRQADC + P1Change
;************************************************************************
INT_ADC_P1:
;MOV
IEN0,#00h
;DISABLE ALL INTERRUPT
;***Check if IRQ was caused by Port Change
;***If PORTIRQSTAT = 00h -> IRQ comes from ADC
MOV
A,PORTIRQSTAT
JZ
CASE_ADC
;*** If interrupt was caused by Port 1, change
CASE_P0CHG:
MOV
PORTIRQSTAT,#00H
;*** Perform other instructions related to Port1 change IRQ
;(...)
;*** Jump to Interrupt end
AJMP
ENDADCP1INT
;*** If interrupt was caused by ADC
CASE_ADC:
ANL
ADCCTRL,#11110011b
;***Reset ADC interrupt flags & Reset ADC for next acquisition
ORL
ADCCTRL,#080h
ORL
ADCCTRL,#11111010b
;*** Perform other instructions related to Port1 change IRQ
;(...)
;** End of ADC and Port 1 Change interrupt
ENDADCP0INT:
ANL
IRCON,#11011111b
;***Enable All interrupts before exiting
; MOV
IEN0,#080H
RETI
END
;ENABLE TIMER 2