Example 1 – simple bit extraction, Example 2 - simple bit packing – ProSoft Technology PS-QS-1x10-0781 User Manual

Page 25

Advertising
background image

FieldServer Configuration Manual

Page 25 of 90

FieldServer Technologies 1991 Tarob Court Milpitas, California 95035 USA Web: www.fieldserver.com

Tel: (408) 262-2299 Fax: (408) 262-2269 Toll Free: (888) 509-1970 email: [email protected]

Parameter Function

Bit_Extract

The function extracts bits out of the source Data_Array Registers at the Data Array offset specified..
The bits are placed into the destination array in sequence. Only one bit is allocated per offset. If the
source array is of Bit Data Array type, a straight move is performed.

Bit_Pack

The function extracts the binary version of each source offset and packs the bits into the Data Array
offset specified. The number of bits packed depends on the target Data type (e.g: Bytes will get 8
bits, Floats will get 32, etc..). The length will specify the number of bits to pack. If the destination
Array is a Bit data type, a straight move is performed.

Bit_Move

The function extracts a subset of bits out of a source Register offset and transfers these to a
destination Register offset in packed form. Length specifies the number of bits to be extracted.

Keywords

Function

Legal
Values

Bit_Offset*

The parameter specifies the bit offset within a word to start at when performing a bit
move. For Bit_Extract operations, the source bit offset in the word pointed to by the
Source_Offset parameter is implied. For Bit_Pack operations, the bit offset within the
word pointed to by Target_Offset is implied.

Default
0

Length*

The length parameter specifies the number of bits to be extracted/packed.

Default
1

5.2.4 Example 1 – Simple Bit Extraction

The following example extracts 3 16-bit registers worth of data from the 6th register of the source array into the
equivalent target of 48 bits:

Data_Arrays

Data_Array_Name , Data_Format , Data_Array_Length
Source_DA

, Uint16

, 200

Target_DA

, Bit

, 200

Moves

Function

, Source_Data_Array , Source_Offset , Target_Data_Array , Target_Offset , Length

Bit_Extract , Source_DA

, 5

, Target_DA

, 0

, 48

5.2.5 Example 2 - Simple Bit Packing

In this example, 12 bits are packed into the 3rd and 4th register of the target byte array, starting at the eleventh bit
in the source array. Note that the second target register will only be half populated, leaving the last 4 bits empty.

Data_Arrays

Data_Array_Name , Data_Format , Data_Array_Length
Source_DA

, Bit

, 200

Target_DA

, Byte

, 200

Advertising
This manual is related to the following products: