SPI Port - Send Data to a shift register - LSB first

Hi folks,

Not sure if here is the right place, but multiplexing = SPI + shift register... :wink:

I am sending data using SPI to a few shift registers, to have a paralel output.

PORTD &= ~_BV(4);                      //Turn Shift register CS PIN LOW); // connects to RCLK
SPI.transfer (highByte (output+results));        // send out upper 8 bits MSB first
SPI.transfer (lowByte (output+results));         // send out lower 8 bits
PORTD |= _BV(4);                       //Turn Shift register CS PIN high - data output changes on this rising edge

This sends the MSB first, however I wish to send the LSB first. How can this be achieved?

Regards

Thanks.
The correct syntax is:

void setup() {
SPI.begin();
SPI.setBitOrder(LSBFIRST);
...
}

void loop(){
 PORTD &= ~_BV(4);                      //Turn Shift register CS PIN LOW); // connects to RCLK
 SPI.transfer (highByte (data));        // send out upper 8 bits MSB first
 SPI.transfer (lowByte (data));         // send out lower 8 bits
 PORTD |= _BV(4);                       //Turn Shift register CS PIN high - data output changes on this rising ed}