0% found this document useful (0 votes)
193 views

Data Manipulation: Overview and Applications

This document provides an overview of data manipulation in LabVIEW, including LabVIEW data types, changing and manipulating data types, and applications involving data manipulation. It discusses LabVIEW numeric, array, and cluster data types. It also covers flattening data, type descriptors, byte-level and bit-level data manipulation, and applications such as data encryption and instrument I/O.

Uploaded by

劉柏亨
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
193 views

Data Manipulation: Overview and Applications

This document provides an overview of data manipulation in LabVIEW, including LabVIEW data types, changing and manipulating data types, and applications involving data manipulation. It discusses LabVIEW numeric, array, and cluster data types. It also covers flattening data, type descriptors, byte-level and bit-level data manipulation, and applications such as data encryption and instrument I/O.

Uploaded by

劉柏亨
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 17

Data Manipulation

Overview and Applications


Agenda
• Overview of LabVIEW data types
• Manipulating LabVIEW data types
– Changing data types
– Byte level manipulation of data
– Bit level manipulation of data
• Applications involving data manipulation
– Data encryption
– Instrument I/O
LabVIEW Data Types: Numeric
Byte 8 bits
Unsigned Byte 8 bits
Word 16 bits
Unsigned Word 16 bits
Long 32 bits
Unsigned Long 32 bits
Single Precision 4 bytes
Double Precision 8
Extended Precision bytes
Windows/Linux: 10 bytes
Power Mac: Double/Double

Sun: 16 bytes
LabVIEW Data Types: Arrays
• Stored as handles containing:
– Size of each dimension (in unsigned long integers, U32s)
– Data (size of elements varies but is consistent through array)
• To align data correctly, a few bytes of padding may be added
before the first element of data
• Array is a continuous block of memory
1D array of SGLs

4D array of I16s
LabVIEW Data Types: Others
• Booleans: 8 bits
– All zeros = FALSE, nonzero = TRUE
• Strings: 1D array of unsigned bytes
• Array of Strings: array of U32 handles to string locations
• Paths: handles containing path type and number of path components in U16s
– Byte 0,1:
• 0 (abs), 1(rel), 3 (UNC)
– Byte 2,3
• # of path components
LabVIEW Data Types: Clusters
• Data stored according to cluster order
• Scalar data stored directly in cluster
• Arrays, strings, and paths stored as a handle to the
memory location where the data is stored
• Padding may need to be added, depending on OS
Example: cluster of SGL, EXT, and 1D array of U16s
Windows Mac Sun
Flattened Data
• Flat data takes up a continuous block of memory
– Scalar and array numerics are flat
– Strings are flat
– Arrays of strings are not flat
– Clusters may be flat (if simple numerics, for example)
• During File I/O LabVIEW automatically flattens all data to ease
storage to disk
• Flatten/Unflatten to/from String functions perform the same
operations in memory
*demo
Flattened Data
• Flattened data normalized to standard form for platform
independence
– Numeric data in big endian form (MSB first)
• Windows apps may need to be little endian – swap bytes
– Sun format for extended precision numbers
• Flattened form does not have data encoding
– When unflattening, data type needs to be known
– Type descriptor used to define data type
*demo
Type Descriptors
• Sequence of word integers that can describe any data
type in LabVIEW.
• <length> <type code>
– <length> I16 size in bytes (including length word)
– <type code> description of data
– Some additional info may follow type code
– Arrays and clusters structured (since there are other data
types)
– Can quickly get complicated to decipher
*demo
Changing LabVIEW Data Types
• Typecast
– Change data type of information
– Works with flat data, 1D arrays of flat
data, and strings
– Default type is string
• Flatten/Unflatten to/from String
– Work with all data
– Behaves like LabVIEW internal
flatten function
*demo
Byte Level Data Manipulation
• Split / Join numeric values into new data
• Swap Bytes/Words to reorder existing data
• Convert data to unsigned
bytes/words/longwords to manipulate at
the byte level
• Convert data to strings to use string
functions for manipulation
*demos (2)
Bit Level Manipulation
• Rotate Left / Right with Carry to
move bits and effect other values
• Rotate to move bits within a value
• Logical shift moves bits, putting 0s in
their place
• Turn data into unsigned bytes to use
these functions easily
• For custom bit manipulation turn
data into Boolean arrays
Applications of Data Manipulation - Encryption
• Standards exist for process (NIST, private corporation, etc)
– Scrambled data is called ciphertext, unscrambled data plaintext
– Data often encrypted using a key – usually a specific number of random
bits and error checking bits
• Ex: 64 bit key: 56 data bits, 8 parity bits (one per byte of key data)
• Symmetric-key (Private Key): each user has access to the same key
– Pro: can be very fast
– Con: easier to compromise (one key to compromise)
• Public-key: each user has a public and private key
• All sorts of algorithms exist to encrypt data (DES, IDEA,
Blowfish, etc)
• Web has a good source of intro pages
– http://www.anujseth.com/crypto/
*demos (3)
How to Encrypt Data?
• Hook a 3rd party DLL (or ActiveX control) into LabVIEW using
the Call Library Node (complexities, speed, usability, etc)
• Grow your own
– Probably not as secure (but good enough?)
– Probably easier to implement/understand
– Some options:
• Simple bit shifting
• Key ciphering with your own algorithm (ex: passwords)
• Implementation of known algorithm in native G-code
Applications – Instrument I/O
• Instruments (GPIB, ethernet, RS-232, etc) can often
transfer data to a host PC in a variety of formats
– ASCII: easiest to read but largest byte transfer
– Binary: more difficult to use but much more compact
• Will probably need to typecast data after it is received
• My need to byte swap data
• Use binary transfers for faster data transfers
• When possible, pick the smallest data type for transfer
Applications - Waveform Transfers
• ASCII Waveforms

• Binary Waveforms
– 1-byte integers

– 2-byte integers
Questions?

You might also like