Shop OBEX P1 Docs P2 Docs Learn Events
Msb,lsb? — Parallax Forums

Msb,lsb?

ArchiverArchiver Posts: 46,084
edited 2002-03-22 15:31 in General Discussion
Can someone please help me. I am trying to visualize what is MSB, and LSB. Is
MSB like this?


100 = 00100110

Or is it like this?

100 = 01100100

I know that LSB is the opposite of MSB.
Any info would be great
A. Conti


[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2002-03-22 02:11
    At 20:37 03/21/02, Anthony Conti wrote:

    >Can someone please help me. I am trying to visualize
    >what is MSB, and LSB. Is MSB like this?
    >
    >100 = 00100110
    >
    >Or is it like this?
    >
    >100 = 01100100
    >
    >I know that LSB is the opposite of MSB.
    >Any info would be great

    MSB and LSB are really neither of the above.

    100 decimal is equal to 01100100 binary. The MSB (most significant bit) of
    the binary number is the first (leftmost) zero and the LSB (least
    significant bit) is the last (rightmost) zero.

    Jim H
  • ArchiverArchiver Posts: 46,084
    edited 2002-03-22 02:27
    > MSB and LSB are really neither of the above.
    >
    > 100 decimal is equal to 01100100 binary. The MSB (most significant bit) of
    > the binary number is the first (leftmost) zero and the LSB (least
    > significant bit) is the last (rightmost) zero.
    >
    > Jim H


    So what you are saying is,

    MSB LSB
    01100100

    If this is true then the stamp would send out 100 like this if it was MSBFIRST

    0 first out
    1
    1
    0
    0
    1
    0
    0 last out

    Am I right?
    A. Conti


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2002-03-22 02:46
    At 21:27 03/21/02, Anthony Conti wrote:
    > > MSB and LSB are really neither of the above.
    > >
    > > 100 decimal is equal to 01100100 binary. The MSB (most significant
    > bit) of
    > > the binary number is the first (leftmost) zero and the LSB (least
    > > significant bit) is the last (rightmost) zero.
    > >
    > > Jim H
    >
    >
    >So what you are saying is,
    >
    >MSB LSB
    > 01100100
    >
    >If this is true then the stamp would send out 100 like this if it was MSBFIRST
    >
    >0 first out
    >1
    >1
    >0
    >0
    >1
    >0
    >0 last out
    >
    >Am I right?

    Yes, that's right.

    Jim H
  • ArchiverArchiver Posts: 46,084
    edited 2002-03-22 03:41
    Hello Anthony Conti;

    The LSB is the right bit in binary always, and the MSB is the left bit, so
    for

    100 = 01100100 is correct. | MSB | 64 | 32 | 16 | 8 | 4 | 2 | LSB |
    | 0 | 1 | 1 | 0 | 0 |
    1 | 0 | 0 |

    64 + 32 + 4 = 100

    MSB for Byte (8 bits) is 128, and for Word (16 bits) it is 32768. I hope this
    will help you out in knowing which
    is correct and visually show how it works.

    Have Fun !!
    Dale Fleischmann

    Anthony Conti wrote:

    > Can someone please help me. I am trying to visualize what is MSB, and LSB. Is
    MSB like this?
    >
    > 100 = 00100110
    >
    > Or is it like this?
    >
    > 100 = 01100100
    >
    > I know that LSB is the opposite of MSB.
    > Any info would be great
    > A. Conti
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and Body
    of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2002-03-22 03:56
    Thank You Jim, and Dale. Now I understand what is MSB, and LSB.

    Thanks
    A. Conti


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2002-03-22 04:00
    Hi Jim Higgins & Anthony Conti;

    The Basic Stamp can put out either the MSB first or the MSB first, here is
    an example of the code for both;

    SHIFTOUT D_out,Clock,MSBFirst,[noparse][[/noparse]pattern] or
    SHIFTOUT D_out,Clock,LSBFirst,[noparse][[/noparse]pattern]

    as you can see above do not assume which is first. In the Basic Stamp Manual
    you can find a lot of information.
    I was having some problems with my code awhile back and found my answers in the
    manual. If you do not have a
    manual either buy one or download it from the following site;

    http://www.parallaxinc.com/html_files/downloads/download_documentation.htm

    Have Fun !!
    Dale Fleischmann

    Jim Higgins wrote:

    > At 21:27 03/21/02, Anthony Conti wrote:
    > > > MSB and LSB are really neither of the above.
    > > >
    > > > 100 decimal is equal to 01100100 binary. The MSB (most significant
    > > bit) of
    > > > the binary number is the first (leftmost) zero and the LSB (least
    > > > significant bit) is the last (rightmost) zero.
    > > >
    > > > Jim H
    > >
    > >
    > >So what you are saying is,
    > >
    > >MSB LSB
    > > 01100100
    > >
    > >If this is true then the stamp would send out 100 like this if it was
    MSBFIRST
    > >
    > >0 first out
    > >1
    > >1
    > >0
    > >0
    > >1
    > >0
    > >0 last out
    > >
    > >Am I right?
    >
    > Yes, that's right.
    >
    > Jim H
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and Body
    of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2002-03-22 05:05
    All numbers have a most significant bit (MSB) and a least significant
    bit (LSB). In base 10 a number like 1240 is read One thousand two
    hundred and twenty four. The one is the MSB and the 0 is the LSB (some
    might say least significant Byte & most significant Byte). Binary and
    Hex are the same story only in a different number base. A number like
    101 can be read from left to right or right to left. I could read the
    LSB first and the MSB second or vice versa. I usually suggest formatting
    the number such that the MSB is on the left and LSB is on the right,
    i.e. as you would read a number in the base 10 system. Problem is in
    binary a number like 101 would be the same number read either way. A
    number like 100 would not be. If I took a number like 100 and said the
    LSB was on the left my number would be a decimal 1. If I said the MSB
    was on the left the decimal equivalent would be a 4. Each number system
    has column weights of what the number adds up to be. In decimal the
    weights are 1000 100 10 1 0 etc. In binary they are 64 32 16 8 4 2 1 0
    etc. Hope this helps..


    Leroy

    Anthony Conti wrote:
    >
    > Can someone please help me. I am trying to visualize what is MSB, and LSB. Is
    MSB like this?
    >
    > 100 = 00100110
    >
    > Or is it like this?
    >
    > 100 = 01100100
    >
    > I know that LSB is the opposite of MSB.
    > Any info would be great
    > A. Conti
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and Body
    of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2002-03-22 15:31
    At 00:05 03/22/02, Leroy Hall wrote:

    >All numbers have a most significant bit (MSB) and a least
    >significant bit (LSB).

    OK so far.

    >In base 10 a number like 1240 is read One thousand two
    >hundred and twenty four.

    No, it is read as "One thousand two hundred forty." Convention is not to
    use the word "and," although many do. The use of "and" incorrectly can be
    confusing when dealing with values having fractional parts, and especially
    when dealing with money.

    >The one is the MSB and the 0 is the LSB (some
    >might say least significant Byte & most significant Byte).

    Some might be incorrect. The concept of bit and byte have no standardized
    meaning in the base ten numbering system. In numbering systems other than
    base 2, the term is "most significant digit" and "least significant digit."

    >Binary and Hex are the same story only in a different number base.

    Binary yes, hex no. See above.

    >A number like 101 can be read from left to right or right to left. I
    >could read the LSB first and the MSB second or vice versa. I
    >usually suggest formatting the number such that the MSB is
    >on the left and LSB is on the right, i.e. as you would read a
    >number in the base 10 system. Problem is in binary a number
    >like 101 would be the same number read either way. A number
    >like 100 would not be. If I took a number like 100 and said the
    >LSB was on the left my number would be a decimal 1. If I said
    >the MSB was on the left the decimal equivalent would be a 4.

    The above contains a good bit of babble and some elements of truth, but the
    truths are based on hypotheses, "if" statements or assumptions, that have
    no real place in the real world. It makes about as much sense to say, "If
    I had horns and a nose that glowed I'd be Rudolph the Red-Nosed Reindeer."

    You "usually suggest formatting the number such that the MSB is on the left
    and LSB is on the right?" I gotta ask, to whom and under what
    circumstances do you ever suggest formatting the other way around?

    >Each number system has column weights of what the number
    >adds up to be. In decimal the weights are 1000 100 10 1 0 etc.

    No, the weights are 1000 100 10 1. There is no zero weight. The weight
    value after 1 in the base 10 system is one-tenth. The transition from
    integral weights to fractional weights is marked with a decimal
    point. There is no zero weight. Zero is formed by placing a 0 in the 1s
    position. You seem to be confusing the positional weight value with the
    concept of a number line.

    >In binary they are 64 32 16 8 4 2 1 0 etc.

    Again, there is no zero weight.

    >Hope this helps.

    So do I.


    Jim H
Sign In or Register to comment.