LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Converting Binary to Decimal

I would like to convert 12 and 32 digit strings into decimal. Is there
a function in labview that does this? Does anyone have a vi (or sub-vi)?

I'm using version 5.1

Thanks!

-DG

dorian@jps.net


Sent via Deja.com
http://www.deja.com/
0 Kudos
Message 1 of 6
(3,856 Views)
use the %b format string in the scan from string function (string functions)

wrote in message news:95qec3$ekn$1@nnrp1.deja.com...
> I would like to convert 12 and 32 digit strings into decimal. Is there
> a function in labview that does this? Does anyone have a vi (or sub-vi)?
>
> I'm using version 5.1
>
> Thanks!
>
> -DG
>
> dorian@jps.net
>
>
> Sent via Deja.com
> http://www.deja.com/
0 Kudos
Message 2 of 6
(3,856 Views)
I've tried that, but to no success (I first convert the array into a
spread sheet string, and then use the scan from string function.

I did write a for while loop to do the conversion (basically using a
shift register and putting the converted bits into an array that's
built be the shift register, then adding them all up at the end).

The numbers look off. Does Labiew intrinsically change the bits like
from 0's to 1's when it's handling them?

Thanks.

-DG


In article <_g3g6.76071$o91.8024384@typhoon.nyroc.rr.com>,
"Stu McFarlane" wrote:
> use the %b format string in the scan from string function (string
functions)
>
> wrote in message news:95qec3
$ekn$1@nnrp1.deja.com...
> > I would like to c
onvert 12 and 32 digit strings into decimal. Is
there
> > a function in labview that does this? Does anyone have a vi (or sub-
vi)?
> >
> > I'm using version 5.1
> >
> > Thanks!
> >
> > -DG
> >
> > dorian@jps.net
> >
> >
> > Sent via Deja.com
> > http://www.deja.com/
>
>


Sent via Deja.com
http://www.deja.com/
0 Kudos
Message 4 of 6
(3,856 Views)
hmmm, now I don't understand the question, because scan from string with a
%b format surely does take a string like "101101101110" and convert it to
decimal number 2926. Could you give a specific example of the string and
the expected result
- Vinny Recca.

dorianjps@my-deja.com wrote:

> I've tried that, but to no success (I first convert the array into a
> spread sheet string, and then use the scan from string function.
>
> I did write a for while loop to do the conversion (basically using a
> shift register and putting the converted bits into an array that's
> built be the shift register, then adding them all up at the end).
>
> The numbers look off. Does Labiew intrinsically change the bits like
> from 0's to 1's when it's handling them?
>
>
Thanks.
>
> -DG
>
> In article <_g3g6.76071$o91.8024384@typhoon.nyroc.rr.com>,
> "Stu McFarlane" wrote:
> > use the %b format string in the scan from string function (string
> functions)
> >
> > wrote in message news:95qec3
> $ekn$1@nnrp1.deja.com...
> > > I would like to convert 12 and 32 digit strings into decimal. Is
> there
> > > a function in labview that does this? Does anyone have a vi (or sub-
> vi)?
> > >
> > > I'm using version 5.1
> > >
> > > Thanks!
> > >
> > > -DG
> > >
> > > dorian@jps.net
> > >
> > >
> > > Sent via Deja.com
> > > http://www.deja.com/
> >
> >
>
> Sent via Deja.com
> http://www.deja.com/
0 Kudos
Message 5 of 6
(3,855 Views)
Hi Vinny,

Thanks for the posting Vinny (and Stu). I did figure it out. The
problem I initially had was that I had a 2-D array going into a for
loop. I can break the array into 1-D arrays and then change this into
an array into a string. No problems.

Thanks!

-DG

In article <3A823A6A.48BCB867@ix.netcom.com>,
vjrecca wrote:
> hmmm, now I don't understand the question, because scan from string
with a
> %b format surely does take a string like "101101101110" and convert
it to
> decimal number 2926. Could you give a specific example of the string
and
> the expected result
> - Vinny Recca.
>
> dorianjps@my-deja.com wrote:
>
> > I've tried that, but to no success (I first convert the array into a
> > sprea
d sheet string, and then use the scan from string function.
> >
> > I did write a for while loop to do the conversion (basically using a
> > shift register and putting the converted bits into an array that's
> > built be the shift register, then adding them all up at the end).
> >
> > The numbers look off. Does Labiew intrinsically change the bits
like
> > from 0's to 1's when it's handling them?
> >
> > Thanks.
> >
> > -DG
> >
> > In article <_g3g6.76071$o91.8024384@typhoon.nyroc.rr.com>,
> > "Stu McFarlane" wrote:
> > > use the %b format string in the scan from string function (string
> > functions)
> > >
> > > wrote in message news:95qec3
> > $ekn$1@nnrp1.deja.com...
> > > > I would like to convert 12 and 32 digit strings into decimal. Is
> > there
> > > > a function in labview that does this? Does anyone have a vi (or
sub-
> > vi)?
> > > >
> > > > I'm using version 5.1
> > > >
> > > > Thanks!
> > > >
> > > > -DG
> > > >
> > > >
dorian@jps.net
> > > >
> > > >
> > > > Sent via Deja.com
> > > > http://www.deja.com/
> > >
> > >
> >
> > Sent via Deja.com
> > http://www.deja.com/
>
>


Sent via Deja.com
http://www.deja.com/
0 Kudos
Message 6 of 6
(3,849 Views)
If your string is all binaray numbers then you can use the from Decimal function
in the strings palette
in the Additionnal string to number functions (labView 5.0.1).


Eric Paulin


dorianjps@my-deja.com wrote:
>I would like to convert 12 and 32 digit strings into decimal. Is there>a
function in labview that does this? Does anyone have a vi (or sub-vi)?>>I'm
using version 5.1>>Thanks!>>-DG>>dorian@jps.net>>>Sent via Deja.com>http://www.deja.com/
0 Kudos
Message 3 of 6
(3,854 Views)