Using SPI and Shiftout together


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: Using SPI and Shiftout together

    Yes, Robert is spot on of course.
    The reason for doing it is that we need to left justify the bits in the word we're shifting out (because the device wants MSB first). It moves the four control bits from the lower four bits of Control to the top four bits of ValueOfToSend then it adds in the actual value shifted two positions to the left in order to "put it" after the first four bits.

    By the way, you had the control value set to 9 in your example so I used that but looking at the datasheet that doesn't seem to be a valid command. Does it really work with a control value of 9?

    /Henrik.

  2. #2
    Join Date
    Oct 2005
    Location
    New Jersey
    Posts
    425


    Did you find this post helpful? Yes | No

    Default Re: Using SPI and Shiftout together

    Quote Originally Posted by HenrikOlsson View Post
    Yes, Robert is spot on of course.
    The reason for doing it is that we need to left justify the bits in the word we're shifting out (because the device wants MSB first). It moves the four control bits from the lower four bits of Control to the top four bits of ValueOfToSend then it adds in the actual value shifted two positions to the left in order to "put it" after the first four bits.
    /Henrik.
    I get it now. Thanks for the explanation.
    By the way, you had the control value set to 9 in your example so I used that but looking at the datasheet that doesn't seem to be a valid command. Does it really work with a control value of 9?
    The control value of 9 is actually for the MCP4912. I'm testing a few things at once.

Similar Threads

  1. Need to use SPI but I'm already using the SPI port
    By Christopher4187 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 30th December 2012, 09:52
  2. Shiftout Modifiers for SPI LCDs (DOGM series)
    By jbike123 in forum PBP Wish List
    Replies: 0
    Last Post: - 9th November 2010, 00:08
  3. SPI instead of SHIFTOUT - MAX7219
    By Momboz in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 26th April 2008, 22:58
  4. Replace Shiftout with spi
    By Pedro Santos in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 7th January 2007, 16:57
  5. SPI on a pic without hardware SPI?
    By modifyit in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 26th April 2006, 13:29

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts