Search code examples
picspipic24

Where can I find documentation on SPI2STATbits?


I've recently come across spi2statbits in the following function:

int WriteSPI2( int data)

{
    int f;
    SPI2BUF = data;                 // write to buffer for TX
    while( !SPI2STATbits.SPIRBF)  
    {f=1;}// wait transfer completion
    return SPI2BUF;                 // read the received value
} // WriteSPI2

I'm using the above in conjunction with a PIC24FJ128GA010 project.

I've been searching around to find more about SPI2STATbits but haven't found actual documentation. I assume this is a fairly basic requirement.

Can someone direct me to the correct documentation?


Solution

  • See page 130 of the datasheet , look for SPIxSTAT.

    For the particular device, do a search for SPI2STATbits in all included header files.

    It's in p24FJ128GA010.h as

    #define SPI2STAT SPI2STAT extern volatile uint16_t SPI2STAT __attribute__((__sfr__)); __extension__ typedef struct tagSPI2STATBITS {...