Peripheral Simulation
For Atmel T87C251G1A — SPI Interface
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.
SPI Dialog
SPI_CLK VTREG
Data Type: unsigned long
SPI_IN VTREG
Data Type: unsigned int
The SPI_IN VTREG contains a byte which is received via the
MCU SPI (Serial Peripheral Interface) port on the next SPI transfer.
You may use this VTREG in a simulation script. For example:
signal void spi_func (void) {
while (1) {
wwatch (SPI_OUT);
printf ("SPI_OUT: %2.2X\n", (unsigned) SPI_OUT);
SPI_IN = SPI_OUT + 1;
}
}
This signal function returns the SPI byte send plus 1 on the next
SPI transfer.
SPI_OUT VTREG
Data Type: unsigned int
The SPI_OUT VTREG contains a byte output via the MCU SPI
(Serial Peripheral Interface) port. When your simulated program sends
a byte via SPI, the SPI_OUT VTREG is set with the value
output. You may monitor this VTREG in a simulation script. For
example:
signal void spi_watcher (void) {
while (1) {
wwatch (SPI_OUT);
printf ("SPI_OUT: %2.2X\n", (unsigned) SPI_OUT);
}
}