LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a string of bits to send out through VISA Serial questions, complete noob here...

Solved!
Go to solution

127 decimal = 111111 binary.

 

Try setting the format string on the Format Into String connected to Messages to %b

 

Lynn

Message 11 of 29
(1,683 Views)

This is an interesting way of getting the final character.  What are you trying to do here?

 

If you are after individual bits, you need to convert to a boolean array.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 12 of 29
(1,670 Views)

@crossrulz wrote:

This is an interesting way of getting the final character.  What are you trying to do here?

 

If you are after individual bits, you need to convert to a boolean array.


Thanks for the reply...

 

I can't find how to convert from a byte array to a boolean array.....suggestions?

 

The earlier poster that showed how a boolean array could be transformed to a byte array using the >0 was interesting....is there another comparison, or other component that I can use to convert from byte array to boolean array....?

 

TIA,

 

cayenne

0 Kudos
Message 13 of 29
(1,654 Views)

cayenne,

 

One issue is just what you want the output array to look like. Do you want a 2D array where each row reperesents the bits in one byte or do you want a 1D array with the booleans concatenated?

 

Here is how you could do the first.

 

Byte array to boolean array.png

 

The other is a bit more involved.

 

Lynn

Message 14 of 29
(1,650 Views)

@johnsold wrote:

cayenne,

 

One issue is just what you want the output array to look like. Do you want a 2D array where each row reperesents the bits in one byte or do you want a 1D array with the booleans concatenated?

 

Here is how you could do the first.

 

Byte array to boolean array.png

 

The other is a bit more involved.

 

Lynn


I believe the 2D array is best way...I could more easily go through each byte at a time to parse them, and act on them.

 

I see in the functions pallete, the number to array component you used in the loop...but where is the boolean array object you're feeding into there? I can't find that.....

 

From your example I'd go something like?

 

byte_array_from_serial_to_boolean_array.png

Thank you,

 

C

 

0 Kudos
Message 15 of 29
(1,645 Views)

It's an indicator.

 

Wire from the Number to Boolean Array to the edge of the For Loop.  You should wind up with an auto-indexing tunnel.  Then right click on that and choose Create Indicator.

 

PS:  You don't need to get the Array Size and wire that to the N node of the loop.  That is taken care of automatically