I have a bit of conditional compiling going on to select mssp1 or mssp2 but is there a way to conditionally check if the pic18 chosen to compile for has 1,2 or no mssp modules .
Code:
#IFNDEF TFT_SPI
#DEFINE TFT_SPI 1
;DEFAULT
#ENDIF
#IF TFT_SPI = 1
SSP1_IF VAR pir1.3
#ELSE
SSP1_IF VAR PIR3.7
#ENDIF
Code:
TFT_CMD:
spi_cbyte :
tft_port = tft_port & (~ tft_dc_bit )
TFT_DATA:
spi_byte :
'@ movff INTCON , _p_int
'@ bcf INTCON ,7
tft_port = tft_port& (~ tft_cs_bit )
SSP1_IF = 0
#IF TFT_SPI = 1
SSP1BUF = CMD
#else
SSP2BUF = CMD
#endif
WHILE SSP1_IF =0 ' wait for SPI interupt flag
wend
tft_port = tft_port | ( tft_dc_bit| tft_cs_bit )
'@ movff _p_int , INTCON
return
the problem is that if the pic has only one mssp then sspbuffer becomes sspbuf where as for two its ssp1buf or ssp2buf.
and it would nice to have shiftout as an option.
other than that it nearly a done deal
Bookmarks