Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/26/07 19:25
Modified:
  02/26/07 19:35

Read: times


 
#133746 - Reverse the bit order
Responding to: ???'s previous message
When I send the 16-bit data I would just send 2 "mov sbuf" commands with a "ti" wait...Is this correct?

Yes. But you have to reverse the bit order of the data, because SPI is MS bit first, instead UART is LS bit first.

Should I use mode "0" with the tx as my clock and the rx as the data?

Yes.
Usually, the UART clock on mode 0 is fixed to 1/12 SYSCLK (or 1/6).
Confirm it on the datasheet.

If you want to make it more compatible, drive the TxD (SCK) pin to '0' by writing corresponding port latch to '0', while the idle state. It ensures polarity of SPI signaling.

In this case, the timing of UART matches to the SPI interface of the chip.
However, it doesn't always match. Confirm the timing chart of both devices before applying this method.

Tsuneo

List of 15 messages in thread
TopicAuthorDate
at89c4051/at89c52 SPI            01/01/70 00:00      
   Bit-bang I'll bet            01/01/70 00:00      
      mcp42010 datasheet            01/01/70 00:00      
         spi bit banging            01/01/70 00:00      
   SPI Interface Is 16-Bit            01/01/70 00:00      
    SPI Interface Is 16-Bit            01/01/70 00:00      
      Reverse the bit order            01/01/70 00:00      
         why not do it the easy way ?            01/01/70 00:00      
            I agree with you, Erik            01/01/70 00:00      
               Usually?            01/01/70 00:00      
                  Thanks Andy,            01/01/70 00:00      
   Reverse the bit order            01/01/70 00:00      
      bit banging            01/01/70 00:00      
         that is the easy part            01/01/70 00:00      
            project requirement            01/01/70 00:00      

Back to Subject List