This Forum is Dedicated For all The Object Oriented PIC Lovers .......... The concept behind OOPic is straight forward. Use preprogrammed multitasking Objects from a library of highly optimized Objects to do all the work of interacting with the hardware. Then write small scripts in Basic, C, or Java syntax styles to control the Objects. During operation, the Objects run continuously and simultaneously in the background while the scripts run in the foreground telling the objects what to do.

Wednesday, May 7, 2008

[oopic] Re: Convert array of Bits to Byte

Yes,

That is the way that I had seen it done before - but I couldn't
remember exactly how it was done.

thanks


--- In oopic@yahoogroups.com, "tuandung248" <trungtuandung@...> wrote:
>
> if you want it faster:
>
> dim v as oByte
> v = bit1;
> v.Lshift(1);
> v = v Or bit2;
> v.Lshift(1);
> v = v Or bit3;
>
> --- In oopic@yahoogroups.com, "design.wonk" <design.wonk@> wrote:
> >
> > Wow, that was so logical. I guess that I was thinking that it had to
> > be more complicated.
> >
> > thanks
> >
> >
> >
> > --- In oopic@yahoogroups.com, Andrew Porrett <slicerwizard@> wrote:
> > >
> > > v = bit1 * 4 + bit2 * 2 + bit3 ?
> > >
> > > At 11:42 PM 5/6/2008, design.wonk wrote:
> > > >I have an array of three bits (based on an object being in
range on a
> > > >combination of three IR sensors). Is there a graceful way to
convert
> > > >this 3-bit array to a single byte value? I have written a function
> > > >that returns a value of 0 to 7 based on the status of the bits
in the
> > > >array, but it uses a long and awkward series of If Then Else
looping.
> > > > I was wondering if there is a simpler way to do this with version
> > 6.1.
> > > >
> > > >thanks
> > >
> >
>

------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:

http://groups.yahoo.com/group/oopic/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:

http://groups.yahoo.com/group/oopic/join

(Yahoo! ID required)

<*> To change settings via email:
mailto:oopic-digest@yahoogroups.com
mailto:oopic-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
oopic-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:

http://docs.yahoo.com/info/terms/

No comments: