English
Language : 

VRS51L2070 Datasheet, PDF (27/99 Pages) Ramtron International Corporation – High-Performance Versa 8051 MCU
VRS51L2070
5.8.2 I/O Port Read Example
;**************************************************************
;* VRS51L2070 I/O Ports Read and Write Example *
;***************************************************************
PORTREAD EQU 021H ;GENREAL VARIABLE
START:MOV PERIPHEN2,#08H ;ENABLE IO
MOV P0PINCFG,#00H ;CONFIGURE P0 AS iNTPUT
MOV P1PINCFG,#00H ;CONFIGURE P2 AS OUTPUT
; Note that the port Input logic is activated by default
MOV
PERIPHEN2,#00001000B ;BIT7 - PWC1EN
;BIT6 - PWC0EN
;BIT5 - AUEN
;BIT4 - XRAM2CODE
;BIT3 - IOPORTEN
;BIT2 - WDTEN
;BIT1 - PWMSFREN
;BIT0 - FPIEN
;*** Read Port 0 and copy the value to P2
LOOP:
MOV PORTREAD, P0
MOV P2, PORTREAD
;Read Prt 0 and store the value in a Variable
;Write the Variable content to P2
AJMP LOOP
In this example, the Port P0 value is stored in a
variable before writing it to P2, but the user can also
directly transfer P0 to P2 in one operation:
LOOP:
MOV P2,P0
AJMP LOOP
;would do the same operation more efficiently
5.9 Port Pin Change Monitoring
The VRS51L2070 includes an I/O port pin change
monitoring subsystem. This module is used to monitor
the activity on the selected I/O ports.
When enabled, if a pin state changes on the selected
I/O port, the PMONFLAG will be set to 1 by the
system. It must be cleared manually by the software.
The port pin change monitoring feature is very useful
for monitoring events that can occur on a given group
of I/Os without having to constantly read the I/O state.
Since it is connected to the VRS51L2070 interrupt
subsystem, the port pin change monitoring system
frees the processor resources for other tasks.
TABLE 44:PORT CHANGE MONITORING REGISTER - PORTCHG SFR B9H
7
6
5
4
3
2
1
0
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
0
0
0
0
0
0
0
0
Bit Mnemonic Description
7
PMONFLAG1 Port Change Monitoring Flag1
When set, monitored port state has changed
6
PCHGMSK1 Port Change Mask Register 1
0 = Port monitoring is deactivated
1 = Port monitoring is activated
5:4
PCHGSEL1[1:0] Port Change Monitoring Register Select 1
00 = P4 Change is monitored
01 = P5 Change is monitored
10 = P6 Change is monitored
11 = P4[3:0] Change is monitored
3
PMONFLAG0 Port Change Monitoring Flag 0
When set, monitored port state has changed
1
PCHGMSK0 Port Change Mask Register 0
0 = Port monitoring is deactivated
1 = Port monitoring is activated
1:0
PCHGSEL0[1:0] Port Change Monitoring Register Select 0
00 = P0 Change is monitored
01 = P1 Change is monitored
10 = P2 Change is monitored
11 = P3 Change is monitored
The port pin change monitoring flags, PMONFLAGx,
are active at all times, even if the port change masks
are not activated. The PCHGMSKx bits serve to
connect the port change module to the VRS51L2070
interrupt system. The port change monitoring flags
must be cleared manually.
________________________________________________________________________________________________
www.ramtron.com
page 27 of 99