LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
danil33

Why Labview does'nt support splitting of a byte into two nibbles

Status: Declined

Hi,

      It is written in the help of  'Split Number Function' that "If you wire an 8-bit integer input, this function does not split the number."Why  Labview does'nt support splitting of a byte into two nibbles??Some times we need to split a byte into nibbles.It is programatically possible with a loop and shiftregister.But Iam asking this because we already have a Split Number Function then why not providing another to split a byte into two nibbles??

 

    

1 Byte                            Nibbles                                        

                                                                                 

        

                                                         

 

 

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thanks as kudos only:)
14 Comments
altenbach
Knight of NI

Probably because LabVIEW does not have a nibble datatype (4bits). 🙂

 

It would keep the data as U8 and pad with zeroes on the right. Splitting a byte into two U8, each containing the value of one nibble does not require a loop or shift register. It is a very simple, near atomic operation. Try it. 🙂

altenbach
Knight of NI

> ... and pad with zeroes on the right

 

Sorry, I meant of course pad on the left. 😉

 

Here's a quick code draft. Make it into a simple subVI if you want. 😄

 

SplitByte.png

danil33
Active Participant

Sorry I mistakenly written "It is programatically possible with a loop and shiftregister".Yes the code you provided is simple.

 

Thank youSmiley Happy

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Thanks as kudos only:)
Knight of NI

I don't know of any modern language that has a nibble data type. In C you'd use a macro to get the two bytes to do the same thing altenbach showed.

 

What would be the advantage of having this datatype added?

altenbach
Knight of NI

You can also do the following, even simpler, maybe slightly slower (not tested).

SplitByte2.png

AristosQueue (NI)
NI Employee (retired)

At some point, it doesn't make sense to split further because the memory space is not addressable at any size less than a byte on any platform LV supports. Once you get below a byte, you have the bit shifting tools to extract a particular bit's value, but you have to store the result as at least a byte.

MaryH
Member
Status changed to: Declined
 
X.
Trusted Enthusiast
Trusted Enthusiast

Can you split a bit?

falkpl
Trusted Enthusiast

With a large enough bit accelerator you should be able to split a bit? 

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
altenbach
Knight of NI

Later you can store it on a HD coated with magnetic monopoles. 😄