LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

String Input to Bits

Solved!
Go to solution

Hi there:

 

I'm taking an ASCII input using a String control and then using convert String to Byte Array to get the byte from each character.  From there, it is my goal to iterate through the byte array and get the individual bits of each byte so that I can manipulate them.  I'm having a hard time figuring out how to do that last part - I've searched a few other topics on this board but they just link to VIs that I don't fully understand.  I would greatly appreciate it if someone could point me in the right direction.

 

Thank you. 

0 Kudos
Message 1 of 7
(3,280 Views)
Solution
Accepted by topic author mwalk99

So you're just trying to get at the bits?

I hope this helps clarify:

This code won't byte.PNG

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 2 of 7
(3,266 Views)

Hi mwalk,

 

use an autoindexing FOR loop with a "number to boolean array" function inside…

 

You know you can manipulate bits directly with U8 values?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 3 of 7
(3,263 Views)

Yes that is what I'm after, thank you.  I guess what I'm confused on is what exactly you did within that loop - I haven't got the slightest idea what those functions are. 

0 Kudos
Message 4 of 7
(3,259 Views)

It's a For loop. The tunnel on the left side is set to Auto-Index through the unsigned byte array (so it's looping through each element). The main nodes inside are Byte Array to String and Number to Boolean Array.

I attached a snippet of the code to the original post, too, so you can drag that on to your block diagram if you have 2014 or newer LV.

 

Become familiar with the LabVIEW palette before you continue. How can you expect to program in the language if you don't know the tools provided?

 

 

"Give me six hours to chop down a tree and I will spend the first four sharpening the axe."  - Abraham Lincoln

 

Here are some free training tools primarily focused on LabVIEW and NI hardware to help get started.

NI Learning Center

NI Getting Started

-Hardware Basics

-MyRIO Project Essentials Guide (lots of good simple circuits with links to youtube demonstrations)

-LabVEW Basics

-DAQ Application Tutorials

-cRIO Developer's Guide

Learn NI Training Resource Videos

3 Hour LabVIEW Introduction

6 Hour LabVIEW Introduction
Self Paced training for students
Self Paced training beginner to advanced, SSP Required
LabVIEW Wiki on Training

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 5 of 7
(3,250 Views)

Aha I got it, thank you all - I didn't realize there was a number to boolean array function already!  Smiley Embarassed

0 Kudos
Message 6 of 7
(3,248 Views)

BuildArray with just one input

U8 array to string - to counterpart to the function you already know

integer number to boolean array

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 7
(3,244 Views)