did not know that shiftin out did more than 8 bit at a time , nice to know ,
i ll take a look at the how it may be done with the MSSP , be nice feature to have running when i get the flash chips that have the duel/ quad interface .
project on hand does not need it but future ones will
the example code i have on hand that uses the MSSP is as follows , suggestions on how this maybe changed
Code:' --- Hardware SPI / SSP register variables --------------------------- SSPEN Var SSPCON1.5 ' SSP enable WCOL Var SSPCON1.7 ' SSP write collision BF Var SSPSTAT.0 ' SSP buffer full SSPIF Var PIR1.3 ' SSP interrupt flag SPI_init: SSPSTAT = %00000000 ' Sample at middle of data output time, Mode 1, 1: Transmit on idle to active clock transition. SSPCON1 = %00010000 ' SPI master mode, clock = Fosc/64, Mode 1, 1: Clock idle high. SSPEN = 1 ' Enable hardware SPI port. return Readbyte: SDC_data_in = SSPBUF ' Clear the buffer. SSPIF = 0 ' Clear the interrupt flag. SSPBUF = $ff ' Shift out a dummy byte. While !SSPIF ' Wait for receive byte. Wend SDC_data_in = SSPBUF ' Get the byte. return writebyte: SDC_data_in = SSPBUF ' Clear the buffer. SSPIF = 0 ' Clear the interrupt flag. SSPBUF = SDC_data_out ' Send the byte. If (WCOL) Then Return ' Check for write collision. While !SSPIF ' Wait for send to complete. Wend return




Bookmarks