mVision 2 Debug Program Example
17-38
17.12
µ
Vision 2 Debug Program Example
SIGNAL void spi_sim (void)
{
/*This program runs in parallel with the
main
program.
It sends out a character byte whose value is post incremented at the end of
each associated time lapse.
SPI_IN is the portal through which the byte data is sent to the
main
program.
In addition, the data transmitted from the
main
program is received at the
portal, SPI_OUT*/
int j;
j = 0x21; //initialize byte data value to be transmitted
spi_in = j;
//send byte data
twatch (100); //idle 100 clock cycles
while (1) //start infinite loop
{
twatch (50);
j++;
//increment value of byte data to be transmitted
spi_in = j;
//transmit another byte of data
twatch (97);
//wait 97 clock cycles
/*data transmitted from
main
program has been receive in portal SPI_OUT
automatically. Its value is displayed in the Command Line display area*/
printf (”\nSPI_OUT = %d”, spi_out);
j++;
/*send another incremented data byte, and receive and display a new data
byte transmitted from
main
.*/
spi_in = j;
twatch (116);
printf (”\nSPI_OUT = %d”, spi_out);
}
}
The data received from the
µ
Version 2 debug program, by the main SPI pro-
gram is written to the Serial #1 window. A snapshot of this window is included
in Figure 17−17.
Содержание MSC1210
Страница 1: ... December 2002 User s Guide SBAU077 ...
Страница 149: ...Digital Filter 12 13 Analog to Digital Converter Figure 12 5 Filter Frequency Responses ...
Страница 162: ...12 26 ...
Страница 234: ...Timers 17 6 Figure 17 4 Timer Counter 1 Mode 1 Figure 17 5 Interrupt System ...
Страница 273: ...Serial Port I O 17 45 Keil Simulator Figure 17 19 Clock Control Peripheral Figure 17 20 USART0 Preipheral ...
Страница 282: ...C 4 ...