LabView 9/27/16 and CSI Ch 10
key points of dataflow
wait to have all input, then execute; reads left to right on operations
Node appearance
want to expand to see all inputs and outputs, expandable node allows you to select btwn diff views
virtual folder
way to organize everything in project
you can't change the address of
what an array points to
Benefits of LabVIEW
wide variety of hardware; built-in analysis libraries
contents of pointer variables may be changed by
addition or subtraction but not multiplication or division
it's sometimes necessary to pass
address of a const item into a pointer
pointer goes through array until address =
address of last element in array; then goes backwards until it points to first element
pointers and dynamic memory
allocation can be used with class objects and structures
dynamic memory allocation
allows program to create own variables "on the fly" can only be done with pointers
address operator isn't needed when
an array's address is assigned to a pointer
pointers can be initialized to
an object's address but object has to exist first
a pointer may be subtracted from
another pointer
control + w
automatically wires everything
an element in an array can be retrieved
by adding subscript to array
pointer can be used as a fxn operator
can change the variable's controls
Waveform
carries data, start time, and dt of a waveform; used in graphs; not x and y, just x and start step
pointer to constant may not be used to
change value it points to; constant pointer may not be changed after initialized
shared folders/auto populating folders
can drag VI's here for it to automatically show up in project
& operator
can retrieve address of variable
array names are
pointer constants-you can't make them point to anything but the array they represent
pointer's data type
pointer to variable
pointer to const points to
constant item-data can't change but pointer can
Icon/Connector pane
useful when making a subVI, can drag onto another VI , helps organize coding
with const pointer, the pointer is
constant, once initialized with the address, it can't point to anything else but can change contents of value
delete
frees up variables pointed to by iptr
what are three parts of a VI
front panel, block diagram, and icon/connector pane
thermocouple measures
voltage
pointers to structures and class variables can be passed to
functions as parameters
control + z
gets rid of broken wires
enum
given options, can make decisions
array[index] =
*(array + index)
control + d
gives indicators and controls (if with constants, control + shift + d)
Language Characteristics
graphical (not text code), data-flow oriented data floating across wires, object oriented
array names without brackets and subscript represents
starting address of array, so it's a pointer
free labels
used for comments make code more understandable
store ____ in a pointer variable after using delete
0; prevents code from inadvertently using pointer to access area of memory that was freed; also prevents errors from occurring if accidentally called a pointer again
short
2 bytes
float/long int
4 bytes
double
8 bytes
Control and Indicators
Controls: inputs; Indicators: outputs; numeric/graph/gauge
context help
control H enables context help
string
control, indicator, can update value of control; constants if want to make a document
express VI
create subVI, run and do step into will get you into subVI; for certain instrument communications; useful if want to go through loop really fast but want to reset display every second
variables may be
created and destroyed while a program is running
we can call the function multiple times with
different arguments for const pointer
red dot
doing something new, like conversion (coercing data)
doorbell
double-sided latch
why would you want to add a fxn to the favorites category in the fxns palette
easier to find
make dependent by
error wire (yellow wire) helps w data flow control
computer hardware can access data at _____ addresses faster than ___ addresses
even; odd
T/F you must create a custom icon to create a subVI
false
when array name dereferenced w a *, it retrieves
first element
Building VI
for functions
Components of a block diagram
for loop, while loops, k structures,
output
has arrow pointing out of it (input has arrow pointing in it)
null pointer
has values at address 0
Wires
helps you see data types passing; broken wire: two data types connected that are incompatible scalars: skinny wires; 1-D and 2-D
++ and --
increment and decrement the pointer variable
*
indicates it's a pointer, allows you to pass from pointer to variable being pointed to and is called the indirection operator
by using *ptr, program directly/indirectly uses the variable after you assign the address of x to ptr
indirectly
when indirection pointer is placed in front of a pointer variable
it dereferences the pointer (work w value the pointer is pointing to)
if program needs new variables
it will request the computer to allocate enough bytes to store
if data type is short then
it would be numbers + 1 * 2(bytes)
clicking mouse
latch (boolean)
block diagram toolbar
lightbulb: enable debugging, show the data run will show actual execution of code; probe: probe data line, lets you see current values; steps: into and over(skip over)
DAQ
measuring physical phenomenon with a computer
why would you use quick drop dialog box instead of the search button and controls
might have error node, sometimes more useful to just type what you want
retain wire values
need this in order to save values when probe the code to see values
pointer to const can also receive the address of a
non-constant item
a pointer is true if it is a
nonzero value
dataflow
not guaranteed order of operation; those without inputs can start before those that need inputs
exception
notifies program that something has gone wrong with operation, default: force executing program to terminate
memory leak
occurs after using a block of memory allocated and forget to free it, remains unavailable until program termination
functions can return
pointers but you must be sure the item the pointer references still exists
dangling
pointing to a memory location that has been freed by delete
data types
properties (modify front panels); boolean data, numeric, strings, enums (number associated w string, like case);
pointer
represents address of a memory location, holds address of some variable
palettes
right click on diagram or front panel, manually look through categories, select for what you want if you don't know what you want, just use quickdrop if you know what you want
char
single byte
memory at address 0 can't be accessed
so assign value 0
what are constants and when should you use them
something you don't want to change; on block diagram, can't interface except w coding
heap
special area of program's memory; when depleted, runtime system will throw an exception to notify that requested memory cannot be allocated
Example finder
specific applications
breakpoints
stops execution there
Dynamic data type
stores info generated or acquired by an Express VI: convert to string or enum
Path
stores location of file or directory; has folder hierarchy inherent in it
Front Panel
string, boolean; includes graphs, can't generate graph on back or block diagram, have to do it here; buttons: run, run continuously, stop, pause(debugging), font, line objects, size objects
control
struct, create own data type, have that be uniform throughout code to give object oriented data approach
->
structure pointer operator; used when want to access a member of a class object through a pointer; used to dereference a pointer to a structure or class
front panel object styles
system control: match windows/mac architecture; classic: very old and simple; silver controls: more 3D looks fancier; modern controls: minimalist approach
use control + space to find
things to do
alternative to passing an argument by reference is
to use a pointer variable
switches
toggles (boolean)
Block Diagram
toolbar, express VIs, wires, where most coding is done in labview
must specify the ______ in pointers
type of data (data that they point to)
when adding a value to pointer
youre adding that value * size of data type referenced by pointer