Serial Peripheral Interface (SPI)
data displayed in the SPICON window, on the basis of the bit position of the corresponding configuration bit within the SFR bit pattern. Likewise, changing the clock rate divide by value changes the SPICON entry accordingly. The re- sult of the oscillator frequency divided by the selected divide by factor is dis- played in the
The trigger level for the transmit IRQ and receive IRQ are selectable through the selection windows marked IRQ Level within the transmit buffer and receive buffer blocks, respectively. The number of data bytes currently in the circular FIFO buffer (waiting to be transmitted or already received and waiting to be read) are displayed in the SPITCON and SPIRCON windows, respectively.
Clicking on the transmit flush buffer box, TXFLUSH, destroys the bytes of data within the circular buffer that are waiting to be transmitted. It changes the SPI trans- mit pointer so that it points to the same address as the FIFO OUT pointer, and clears the transmit counter value within the SPITCON SFR. The transmit counter indicates the number of bytes within the circular buffer that are waiting to be trans- mitted. Similarly, clicking on the receive flush buffer RXFLUSH box, destroys the bytes of data, within the circular buffer, that have already been received, but still waiting to be read by the processor. It forces the receive pointer to point to the same address location as the FIFO IN pointer, and it resets the receive counter value within the SPIRCON SFR. The receive counter indicates the number of bytes with- in the circular buffer that are waiting to be read by the processor.
It is worth stressing that all this window text editing and check box marking are just alternative methods of programming the various SFRs in software.
The circular buffer can be set or redefined, by writing the desired value into the editable transmit pointer window (SPISTART) and the editable receive buffer window (SPIEND). You will observe that whatever entry is made into the SPIS- TART text window also appears in the
Data written into the editable text window SPIDATA will be handled as a piece of data to be transmitted. The SPITCON and SPISTART windows will be prop- erly updated, the circular buffer entry will be made into the appropriate buffer address pointed to by the transmit pointer. The values in the SPITCON window
Keil Simulator |
|
|