Peripheral Simulation
For Atmel AT8xC5122 — Smart Card Interface Block
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.
Multi-protocol Smart Card Interface Dialog
The Keil Debugger simulates the Multi-protocol Smart Card
Interface. The configuration is reflected in the Smart Card Interface
Dialog that you may open from the Peripherals Menu. Values of the
SFRs that configure the Smart Card Interface are displayed in the
dialog. You may use the controls in the dialog to override the
settings configured by your target program.
SC_SIN VTREG
Data Type: unsigned int
The SC_SIN VTREG represents the serial input of the Multi-protocol
Smart Card Interface. Values you assign to SC_SIN are input to this
serial channel. You may assign input using the command window. For
example,
SC_SIN='A'
causes the simulated microcontroller Smart Card Interface to
receive the ASCII character A. If you want to use the SC_SIN VRTEG to
simulate reception of multiple characters, you must be sure to delay
for atleast one character time between successive assignments to SIN.
This may be done using a signal function. For example:
signal void send_cat (void) {
swatch(0.01); /* Wait 1/100 seconds */
SIN='C'; /* Send a C */
swatch(0.01);
SIN='A';
swatch(0.01);
SIN='T';
}
The simulator assigns the value 0xFFFF to SC_SIN when the previous
value is completely processed and a new value can be received. In
addition to the SC_SIN VRTEG, the serial window allows you to input
serial characters by simply typing. Serial characters that are
transmitted by the Smart Card Interface appear in the serial
window.
SC_SOUT VTREG
Data Type: unsigned int
The SC_SOUT VTREG represents the serial output from the simulated
Multi-protocol Smart Card Interface. Whenever the Smart Card port
transmits a character, the value transmitted is automatically
assigned to SC_SOUT (which is read-only). You may read the value of
SC_OUT to determine the character transmitted by your simulated
program. For example,
S0OUT
outputs the value of the last character transmitted. You may use
the SC_SOUT VTREG in a script to process transmitted data. For
example,
signal void s0out_sig (void) {
while (1)
{
wwatch(S0OUT); /* wait for something in S0OUT */
printf ("Transmitted a %2.2X\n", (unsigned) S0OUT);
}
}