SHIFTOUT MSB/LSBFIRST clarification


Closed Thread
Results 1 to 18 of 18

Hybrid View

  1. #1
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326

    Default SHIFTOUT MSB/LSBFIRST clarification

    good day to all in this forum,
    I am using PicBasic pro to load an 8 bit shift register and I wrote a very simple program like this:

    INCLUDE "MODEDEFS.BAS"
    DT var byte
    DT=128 ' decimal
    SHIFTOUT H_DATA,H_CLK,msbfirst ,[DT\8]

    Then I do suppose that the MSB ( in this case "1" ) is transmitted first and then "0000000" is transmitted after it.
    By looking to the output stream with a scope, I find that the bit at logic level = high ( dec 128) is shown to the left side of the scope and not at the right side of the scope display.
    I am just a little bit confuesd about that: any clarification please ?
    Thanks in advance.
    bye

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: SHIFTOUT MSB/LSBFIRST clarification

    I haven't done this in a long time but here is a snippet of code I used to send by SPI to a device:

    Low PORTA.3 : Pause 10 'CHIP SELECT
    ShiftOut PORTC.5,PORTC.3,0,[9254\16] 'playconfig0
    ShiftOut PORTC.5,PORTC.3,0,[114\8] '1st play byte
    High PORTA.3 : Pause 10 'deselect - end of word

    The 0 after portc.3 means send code LSB. A 1 would send it MSB.
    Last edited by peterdeco1; - 26th May 2021 at 19:25.

  3. #3
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default Re: SHIFTOUT MSB/LSBFIRST clarification

    thanks a lot,
    Is your SPI device set to receive MSBfirst or LSBfirst please ?
    Bye

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,389


    Did you find this post helpful? Yes | No

    Default Re: SHIFTOUT MSB/LSBFIRST clarification

    time on a scope flows from left to right
    Name:  scope.jpg
Views: 435
Size:  68.2 KB
    Warning I'm not a teacher

  5. #5
    Join Date
    Jun 2008
    Location
    Varese , Italy
    Posts
    326


    Did you find this post helpful? Yes | No

    Default Re: SHIFTOUT MSB/LSBFIRST clarification

    I am so sorry Richard:
    if the time flows from left to right, then the first bit sent should be on the right and not to the left of the scope !
    Where am I wrong please ?
    Bye

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,389


    Did you find this post helpful? Yes | No

    Default Re: SHIFTOUT MSB/LSBFIRST clarification

    which second was recorded first in time sequence ?

    Name:  scope.jpg
Views: 388
Size:  93.1 KB
    Warning I'm not a teacher

Similar Threads

  1. Need to flip order of bits MSB to LSB re: MCP23S17
    By Ryan7777 in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 30th May 2015, 01:42
  2. MSB Compile error
    By RFEFX in forum PBP3
    Replies: 2
    Last Post: - 26th January 2015, 06:32
  3. DT Instant Interrupts - Clarification?
    By Aussie Barry in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 26th December 2013, 12:45
  4. Replies: 4
    Last Post: - 7th April 2013, 00:46
  5. Pro upgrade clarification
    By fowardbias in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 24th January 2010, 21:17

Members who have read this thread : 1

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