Turns out I didn't need to swap the bits after all, but it sure sparked a lot of neat 
code!

Jason

Roger Chaplin wrote:

> "Jason Simpkins" <[EMAIL PROTECTED]> wrote:
>
> > The serial data is read no problem, and actually I figured out most of my
> > other problems, I also have a bit and byte swapping function that I'm going
> > to post that works pretty darn good.
>
> Actually, bit order shouldn't be a problem. If the sender and receiver
> are both RS-232, the bits will arrive at the receiver in the same order
> that the sender sends them. Byte order will depend on endian-ness, of
> course.
>
> [ very long bit swap routine deleted ]
>
> Try this:
>
> unsigned char BitSwap (unsigned char in)
> {
>     unsigned char out, inmask, outmask;
>
>     for (out = 0, inmask = 1, outmask = 0x80;
>          outmask;
>          inmask <<=1, outmask >>= 1)
>     {
>         if (in & inmask)
>             out |= outmask;
>     }
>
>     return out;
> }
>
> --
> Roger Chaplin
> <[EMAIL PROTECTED]>
>
> --
> For information on using the Palm Developer Forums, or to unsubscribe, please see 
>http://www.palmos.com/dev/tech/support/forums/


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to