I am trying to use serial Port A and serial port B on the rabbit 5400W (SPI interface to communicated with other IC). But the supplied SPI library only support to use one port at a time. It will be time consuming to call SPIinit to change between ports. So can you provide me some sample code to show me how to do this, or point me to the right source. I had read a sample SPI application note document. And wrote something like:
int _SPIA_WrRd(char data)
// load the first byte to SADR, serial port A data register
WrPortI(SBDR, NULL, data);
BitWrPortI(SACR, &PCFRShadow, 1, 7);
BitWrPortI(SACR, &PCFRShadow, 1, 6);
// Check status register for incoming data
status = RdPortI(SASR);
return -1; // error
But not sure if this right…Can’t really find a good document describing how to configure SPI port manually, so it can support using two SPI serial ports.
Thanks for your help.