trying to use SPI example with RCM4300 in Dynamic C, but can't find where the transmit and recieve bits are specified.

I need to use SPI to interface to a Honeywell IPT (pressure transducer). I didn’t want to use serial interface B, as the manual says it might conflict with other operations, but I can’t see where in the example code I can specify the transmit and receive bits used in the parallel port if I use Serial interface C…

1 Like


You need to add the two defines to the top of your program:

#define SPI_SER_C
#define SPI_CLK_DIVISOR 100 //or some other appropriate number

The default pins for SPI_SER_C are PC2 for MOSI or Tx and PC3 for MISO or Rx. If you would rather have one of the alternate port pins for serial port Rx you can use one of the following macros:

SPI_RX_PORT define to one of the following to select which parallel port is used for the receive bit
SPI_RX_PC if using parallel port C
SPI_RX_PD if using parallel port D
SPI_RX_PE if using parallel port E

SPI_RX_PD would be PD3 and SPI_RX_PE would be PE3. You can see all of this in spi.lib.