// Lesson #18 - 2

// SPI_Slave

// September 7th, 2012


void init(void)

{

TRISA.B5 = 1;

TRISB.B0 = 1;

TRISB.B1 = 1;

ADCON0 = 0;

ADCON1 = 0x0f;

SSPSTAT.B6 = 1;

SSPSTAT.B7 = 0;

SSPCON1 = 0b00100100; // _ss en

}


void main() {

Soft_UART_Init(&PORTB, 6, 7, 9600, 0);

init();

while(1)

{

while(!SSPSTAT.B0){}

Soft_UART_Write(SSPBUF);

Soft_UART_Write(0x0D);

Soft_UART_Write(0x0A);

Delay_ms(10);

}

}