LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to divide binary string in two binary strings.

Solved!
Go to solution

hello everyone ...

i converted decimal numbers which are from 0 to 200 into the binary string of 8 bits. now i want to divide it in two equal part first 4 bits and other 4 bits. the Vi is attached. 

0 Kudos
Message 1 of 15
(2,581 Views)

Please attach your VI instead of a blurry picture.

 

So you have an U8, i.e. 8 bits and want two 4bit numbers (nibbles). You don't need anything pink for that, just some quick masking and shifting is sufficient.

 

What exactly do you want ant the end? (I would stick with numerics. Strings are useless for e.g. math)

 

altenbach_0-1658329913311.png

 

0 Kudos
Message 2 of 15
(2,567 Views)
Solution

Looks like you are all but there.  What exactly were you having problems with?

 

You can eliminate most of your code (the FOR loop and most of the supporting code) by changing the string format to %08b.



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 3 of 15
(2,563 Views)

@User002 wrote:

the Vi is attached. 


No, that's an image of the VI...

 

And you can embed images in a post, saving us a download, open and delete.

binary

Try:

wiebeCARYA_0-1658329987105.png

 

EDIT: that crossed a few messages. At least my rant is constructive 😁.

0 Kudos
Message 4 of 15
(2,555 Views)

Hi jeet,

 

one more try:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 15
(2,490 Views)

wiebe@CARYA wrote:

EDIT: that crossed a few messages. At least my rant is constructive 😁.


Not implying the other rants where not constructive, just that my rant was constructive compared to my answer. I wasn't dissing rants. 🙄

0 Kudos
Message 6 of 15
(2,479 Views)

@GerdW wrote:

Hi jeet,

 

one more try:


wiebeCARYA_1-1658393526419.png

 

(too hard to resist)

Message 7 of 15
(2,476 Views)

@GerdW wrote:

Hi jeet,

 

one more try:


 

Cute! Not sure what the compiler does with all this, but my gut feeling is that this requires quite a few more clock cycles compared to my solution. 😄

0 Kudos
Message 8 of 15
(2,446 Views)

@altenbach wrote:
Cute! Not sure what the compiler does with all this, but my gut feeling is that this requires quite a few more clock cycles compared to my solution. 😄

Sure.

I also wouldn't use Q&R on an FPGA…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 15
(2,439 Views)

@altenbach wrote:

@GerdW wrote:

Hi jeet,

 

one more try:


 

Cute! Not sure what the compiler does with all this, but my gut feeling is that this requires quite a few more clock cycles compared to my solution. 😄


But it does (at least somewhat) fit onto a postage stamp, so there's that...

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 10 of 15
(2,435 Views)