MT Pack Bits VI

LabView Digital Modulation

MT Pack Bits VI

Packs data to an unsigned or signed integer array. You can specify the order in which the bits are packed into the integer array either as MSB First or LSB First. You can also specify the integer format to be Signed or Unsigned using the integer format parameter.

This VI packs MN-sized binary data of the form b i={0,1}, i=0…MN–1 to an unsigned or signed integer array a n n=0…N–1 of size N, where M denotes the number of bits per integer.

Details

MT Pack Bits

c1di8.gif

input bit stream specifies the binary bit stream b i={0,1}, i=0…MN–1 to be packed into integers. The default is empty.

ci32.gif

bits per integer specifies the number of binary data values that are packed into an integer. If you choose Unsigned for the integer format, the maximum value is 31. If you choose Signed, the maximum value is 32. The default is 1.

cenum.gif

packed bit order specifies the order in which the binary data stream has been packed into integers.

MSB first (0)

Data is packed with the most significant bit (MSB) first. This is the default value.

LSB first (1)

Data is packed with the least significant bit (LSB) first.

cenum.gif

integer format specifies the input integer format.

Unsigned (0)

The entire number is packed as a positive integer. This is the default value.

Signed (1)

The most significant bit (MSB) determines the sign of the input integer.

cbool.gif

reset ? specifies how the VI handles buffered data. When the length of the input bit stream is not a multiple of the bits per integer value, the leftover bits are buffered inside the VI. When reset? is set to FALSE, these buffered bits are prepended to the input bit stream during the next iteration. The default is TRUE.

ccclst.gif

error in (no error) can accept error information wired from previously called VIs. Use this information to decide if any functionality should be bypassed in the event of errors from other VIs. Right-click the front panel error in control and select Explain Error or Explain Warning from the shortcut menu for more information about the error.

cbool.gif

status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred. Right-click the front panel error in control and select Explain Error or Explain Warning from the shortcut menu for more information about the error.

ci32.gif

code identifies the error or warning code. Right-click the front panel error in control and select Explain Error or Explain Warning from the shortcut menu for more information about the error.

cstr.gif

source describes the origin of the error or warning. Right-click the front panel error in control and select Explain Error or Explain Warning from the shortcut menu for more information about the error.

i1di32.gif

output integers returns the output integer stream a n n=0…N–1 corresponding to the packed bits.

icclst.gif

error out passes error or warning information out of a VI to be used by other VIs. Right-click the front panel error out indicator and select Explain Error or Explain Warning from the shortcut menu for more information about the error.

ibool.gif

status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred. Right-click the front panel error out indicator and select Explain Error or Explain Warning from the shortcut menu for more information about the error.

ii32.gif

code is the error or warning code. Right-click the front panel error out indicator and select Explain Error or Explain Warning from the shortcut menu for more information about the error.

istr.gif

source describes the origin of the error or warning. Right-click the front panel error out indicator and select Explain Error or Explain Warning from the shortcut menu for more information about the error.

Details

The relationship between the output integers array and the input bit stream for the Unsigned integer format is given by the following equations:

(packed bit order set to MSB First)

(packed bit order set to LSB First)

If the integer format is set to Signed, then the MSB at the bit position N-1 is used to determine the sign of the output integer. The sign is positive if MSB is 0 and negative if MSB is 1. For example, if you set the integer format to Unsigned and bits per integer as 3, and packed bit order as MSB First, the bits [1 0 0] are mapped to the integer 4. If packed bit order is specified as LSB First, the bits are mapped to the integer 1. If the integer format is set to Signed and packed bit order is MSB First, the bits [1 0 0 ] are packed to integer –4 because the MSB is 1 in this case. If packed bit order is set to LSB First, the bits are mapped to integer 1, because MSB is 0 in this case.

Note  This VI is continuable, meaning that you can call it for multiple iterations inside a loop with reset? set to FALSE. In this case, the VI buffers the leftover bits whenever the length of the input bit stream is not a multiple of the specified bits per integer. These leftover bits are prepended to the beginning of the input bit stream during the next iteration, provided reset? is set to FALSE.