SPI (Serial Peripheral Interface)

Discussion in 'General Electronics Chat' started by mchabib, Aug 27, 2010.

  1. mchabib

    Thread Starter New Member

    Jul 20, 2010
    5
    0
    HI everyone,

    I want to transfer a byte from one microcontroller to another using SPI,
    i just want to know if the transmitted byte is reversed in the other microcontroller.
     
  2. kingdano

    Member

    Apr 14, 2010
    377
    19
  3. mchabib

    Thread Starter New Member

    Jul 20, 2010
    5
    0
    i'm using a pic18f2331 to transfer data to dspic30f6010, but in the pic18f2331 datasheet : "The SSP consists of a transmit/receive Shift Register (SSPSR) and a buffer register (SSPBUF).The SSPSR shifts the data in and out of the device, MSb first. The SSPBUF holds the data that was written to the SSPSR, until the received data is ready."

    in the dspic datasheet: " Data is transmitted out of bit 7 of the SPIxSR for 8-bit operation while it is transmitted and out of bit 15 of the SPIxSR for 16-bit operation. In both modes, data is shifted into bit ‘0’ of the SPIxSR."

    Does this mean that the data will be received in the dspic in a reversed way than it is in the pic?
    I didn't understand it completely, and it's the only information that i could find concerning transmission, and i read the link you sent me
    thank you for your help

     
  4. Papabravo

    Expert

    Feb 24, 2006
    10,135
    1,786
    In the usual case SPI data is transmitted MSB first and enters the destination shift register at the LSB. After 8 clocks that original bit is now in the MSB. Same for the data on the reverse path. Some SPI hardware allows you to choose which bit goes first on the wire.
     
  5. mchabib

    Thread Starter New Member

    Jul 20, 2010
    5
    0
    yeh, if that's the case then i have no problem.
    i'll test it and see
     
Loading...