Peripheral Simulation
For Atmel AT8xC5122 — Smart Card Interface Hardware Configuration
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.
SmartCard Hardware Interface Dialog
This dialog (available from the Peripherals menu) displays the
status of the SmartCard Hardware Interface.
-
System Clock: This value specifies the frequency of the
external oscillator. It corresponds to the virtual register
XTAL.
-
Main Card Clock: Specifies the frequency that is
supplied to the main smart card.
-
Alternate Card Clock: Specifies the frequency that is
supplied to the alternate smart card
-
div. factor for ser. interface: Specifies the clock
prescaler for one 'Elementary Timing Unit (ETU)' for the software
ISO interface (not for UART). It corresponds to the virtual
register SDIV.
-
Resulting Baudrate: Displays the resulting baudrate (=
XTAL / SDIV) for the software ISO interface.
-
Parity: Selects the simulated parity for the software
ISO interface. It corresponds to the virtual register
USE_PAR.
-
Use serial Hardware Interface: If selected, the serial
in/output is directed to a COM port of the PC. If not selected, the
serial in/output goes to the serial window. It corresponds to the
virtual register HWI.
-
Serial Interface: Specifies the COM port of the PC for
serial in/output. It corresponds to the virtual register
USE_COM.
-
Baudrate: Specifies the baudrate for the COM port of the
PC. It corresponds to the virtual register USE_BR.
-
Parity: Specifies the parity for the COM port of the PC.
It corresponds to the virtual register USE_PAR.
-
Clock (DTR): Displays the level of the DTR handshake
line of the COM port of the PC. This line is used to switch on/off
the clock generator of the smartcard interface.
-
Power (RTS): Displays the level of the RTS handshake
line of the COM port of the PC. This line is used to switch on/off
the power supply of the smartcard interface.
HWI VTREG
Data Type: unsigned char
The HWI VTREG specifies whether the hardware interface should be
used or not. The value 0 means that the serial input/output is
simulated in the serial window. The value 1 means that the bytes are
sent and received through the serial interface of the PC. With a
suitable interface, the simulator can be used to interface to a chip
card. The HWI VTREG can be used in simulator initialization script
for automatic tests:
USE_BR = 9600 /* select 9600 baud */
USE_COM = 1 /* use COM2 */
HWI = 1 /* select hardware interface */
SDIV VTREG
Data Type: unsigned int
The SDIV VTREG specifies the clock prescaler for one 'Elementary
Timing Unit (ETU)' when the serial transmission/reception is done by
software. One ETU is the duration of one bit on the smartcard ISO
interface. Together with XTAL, the baudrate is calculated as
‘baud = xtal / sdiv’. The default value is 372. SDIV is
not significant when the on-chip UART is used.
USE_BR VTREG
Data Type: unsigned long
The USE_BR VTREG specifies the baudrate of the COM port of the PC
when HWI it set to 1. This baudrate and the one from the 'Software
ISO Interface' can be different. The default value is -1
(=0xFFFFFFFF). This value specifies that the baudrate of the COM port
of the PC follows the selected on-chip UART baudrate.
USE_COM VTREG
Data Type: unsigned char
The USE_COM VTREG specifies the number of the COM port of the PC
which is used when HWI is set to 1. The default value 1 means that
COM1 is used. Values from 1 to 8 are allowed.
USE_PAR VTREG
Data Type: unsigned char
The USE_PAR VTREG specifies the parity-mode of the COM port of the
PC and the parity of the software ISO interface.
0 = even parity
1 = odd parity
2 = no parity
XTAL VTREG
Data Type: unsigned long
The XTAL VTREG contains the frequency of the oscillator (in Hertz)
used to drive the microcontroller. The value is automatically set
from the value specified in Project Options - Options for Target.
However, you may change the value of XTAL using the command window.
For example:
XTAL=12000000
You may also output the current value of XTAL using the
following:
XTAL
XTAL may be used in calculations to synchronize external scripts
with the simulated microcontroller.