debug Module

Files:

Interface:

Function: InitSPI
Arguments: None.
Returns: None.
Description:Intializes SPI on the E128 - makes it a master.

Function: InputSPI
Arguments: Character representing the debug value to display.
Returns: None.
Description:Passes a number value 0-9 to send via SPI, sets the transmit ready flag.

Function: TransmitSPI
Arguments: None.
Returns: None.
Description:Sends the value stored over the SPI line to the C32 Calls this function periodically to update what appears on the display.

Pseudo-Code:

 
void InitSPI(void)
   Set baud rate to /256
   Set phase to mode 3
   Make E128 master
   Enable SPI 			                   
   Send Initial Byte

void InputSPI(char debugvalue)
   Set static variable State to debugvalue
   Set SPI_Transmit_Ready flag to YES
   
void InputSPI(char debugvalue)
   Set static variable State to debugvalue
   Set SPI_Transmit_Ready flag to YES
   
void TransmitSPI(void)
   If SPI_Transmit_Ready flag is YES
   Clear the transmit flag and Send Data
       Read SPISR register
       Write State to SPIDR register
   Reset SPI_Transmit_Ready flag