Serial Peripheral Interface (SPI)
17-37
Keil Simulator
if (AISTAT & 0x04)
{/*Receiver*/
i = SPIRCON & 0x7F; //extract the count for the number of
AISTAT &= ~0x04; //deactivate SPI receive flag
if (l >= 50)
{
/*do not exceed the 50 received_data[] array limit*/
for (l = 0; l < 5; l++)
{
printf (”\n”);
for (k = 0; k < 10; k++)
{
printf (” %c”, received_data[k + l * 10] );
}
}
printf (”\n”);
l=0;
//reset the received_data[] array index.
}
for (k = 0; k < i; k++)
{
if (l >= 50)
break;
/*data received through the SPI channel is read at the SPIDATA SFR*/
received_data[l++] = SPIDATA; //keep track of received data
}
}
}
void main(void)
{
setport ();
init_spi ();
test_spi ();
}
In addition to the main simulation program, a
µ
Vision 2 debugging program
was also written to supply the received data to the test simulation program.
This
µ
Vision program transmits and receives data at periodic intervals from the
main program. The SPI communication protocol is used for this data transfer.
The
µ
Version 2 debug program behaves as the slave, while the main program
is the master. The debug program is presented and explained in the following
section.
Содержание 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 ...