News:

Let's find out together what makes a PIC Tick!

Main Menu

SPI2

Started by Pepe, Feb 15, 2022, 11:56 PM

Previous topic - Next topic

Pepe

In the Amicus18_spi.inc file it shouldn't say WREG = SSP2BUF
Is my version old?
'-----------------------------------------------------------------------------------
' Macro Name    : ReadSPI2
' Return Value  : Contents of SSP2BUF register
' Parameters    : None
' Description  : Read byte\s from the SPI2 bus.
'
$define ReadSPI2() _ReadSPI2

_ReadSPI2 Macro- \Byte
    GoSub __ReadSPI2
    Return_WREG
Endm

#ifMacro- _ReadSPI2
__ReadSPI2:
    WREG = SSP2BUF                  ' Empty the SSP2BUF buffer and clear flags
    PIR3bits_SSP2IF = 0            ' Clear interrupt flag
    SSP2BUF = $FF                  ' Initiate bus cycle
    Btfss PIR3bits_SSP2IF          ' \
    Bra $ - 2                      ' / Wait until cycle complete


------------>    WREG = SSPBUF      ' Read SSP2BUF into WREG


    Return
#endIfMacro-

top204

#1
That file is now about 12 years old, and it shows how many people actually used the Amicus18 because it was never promoted or advertised and I wasted months of my own time and effort on something for another company, free of charge because of stupid loyalty that meant nothing to the company, and it had no benefit to me at all. NEVER again!!!! :-)

Yes... It should be "WREG = SSP2BUF".

Pepe

Thank you Les, I am sorry that all your knowledge and effort has not been well paid.