Peripheral Simulation
For Infineon XC164CM-16F — Port 3 (13-bit I/O with Open Drain)
Simulation support for this peripheral or feature is comprised of:
- Dialog boxes which display and allow you to change peripheral configuration.
- VTREGs (Virtual Target Registers) which support I/O with the peripheral.
These simulation capabilities are described below.
Parallel Port 3 Dialog
This dialog displays the SFR and pins of Port 3. This port has
several alternate functions but it may be used as a 13-bit general
purpose I/O port.
-
P3 represents the P3 SFR. The HEX value and value of
each bit is displayed and may be changed from this dialog. Note
that P3.14, P3.12 and P3.0 are not available.
-
DP3 is the port direction SFR for P3. When DP3.x=0, P3.x
is an input. When DP3.x=1, P3.x is an output.
-
ODP3 is the open drain control SFR for P3. When
ODP3.x=0, the P3.x output driver works in push/pull mode. When
ODP3.x=1, the P3.x output driver works in open drain mode. Note
that P3.15 does not support open drain mode.
-
ALTSEL0P3 selects the alternate functions of SSC0, ASC0,
ASC1 and GPT.
-
ALTSEL1P3 selects the alternate functions of SSC0, ASC0,
ASC1 and GPT.
-
Pins represents the states of the pins on the simulated
MCU. When used as outputs, these have the same value as the P3 SFR.
When used as inputs (DP3.x is 0) you may set the level of the input
pin to high (1) or low (0).
PORTx VTREG
Data Type: unsigned int
The PORTx VTREGs represent the I/O pins of the simulated
MCU for Port 0, Port 1, and so on. You may read PORTx to
determine the state of the output pins of that port. For example, in
the command window, you may type,
PORT8
to obtain the value corresponding to the set pins of Port 8. You
may also change the input values of port pins by changing the value
of the VTREG. For example,
PORT7=0x00F0
sets bits 4-7 and clears bits 0-3 and 8-15. You may use the
bitwise operators AND(&), OR(|) and XOR(^) to change individual
bits of the PORTx VTREGs. For example:
PORT2 |= 0x0001; /* Set P2.0 Pin */
PORT8 &= ~0x0002; /* Clr P8.1 Pin */
PORT7 ^= 0x0080; /* Toggle P7.7 Pin */
PORTxH/L VTREG
Data Type: unsigned char
The PORTxH and PORTxL VTREGs represent the I/O pins
of the simulated MCU for Port 0 and Port 1. Most ports have a single
VTREG (like PORT7 or PORT8) but some (like Port 0 and Port 1) have
two VTREGs (PORT0H and PORT0L). You may read PORTxL or
PORTxH to determine the state of the output pins of that port.
For example, in the command window, you may type,
PORT0L
to obtain the value corresponding to the set pins of the lower 8
bits of Port 0. You may also change the input values of port pins by
changing the value of the VTREG. For example,
PORT1H=0xF0
sets bits 4-7 and clears bits 0-3 of Port 1. You may use the
bitwise operators AND(&), OR(|) and XOR(^) to change individual
bits of the PORTx VTREGs. For example:
PORT1L |= 0x01; /* Set P1L.0 Pin */
PORT0H &= ~0x02; /* Clr P0H.1 Pin */
PORT0L ^= 0x80; /* Toggle P0L.7 Pin */