Re: Bit twiddling



On Sat, 04 Jun 2005 09:11:56 -0400, Joe Wright
<joewwright@xxxxxxxxxxx> wrote:

> Chris Croughton wrote:
>>
>> That's a good reason for numbering with 0 as LSB! European comms
>> specifications had the 'standard' of numbering 0 as MSB, I believe that
>> it got into some early RFCs as well (I've certainly seen it in some
>> non-European spec.s). Most confusing, especially when dealing with
>> multiple specifications in the same project (the lower layers have bit 0
>> as most significant, whereas the higher layers have bit 0 as LSB -- or
>> is it the other way round? Madness!)
>
> In the end, happily, it doesn't matter. It's just a matter of notation.
> It doesn't change the way the machine works, only how it's described in
> the docs.

Which can mean a lot of time wasted getting protocols wrong. I was
lucky, when I started doing TCP/IP the communications were already out
there so I only had to do some 'sniffing' of them to confirm that the
spec. had the bits the other way round, but if it isn't defined properly
that sort of thing can cause a lot of wasted time and effort.

> More interesting is a bit's value in time. Think of async serial bytes:
> start bit, 8 data bits and stop bit. It is of crucial importance that we
> know whether the bit after the start bit is the lsb or the msb of the
> byte. I used to know. Really. :-)

LSB first (see CCITT V.24) <g>. That one I /do/ remember, I was
programming async serial comms for a long time...

Chris C
.