LabVIEW Programming Essentials: Data Flow and Program Control Review
E N D
Presentation Transcript
LabVIEW Program and Data Flow Review LabVIEW Robotics Fundamentals
Data Flow • Many code objects in LabVIEW generate data • Constants always put outone “constant” value • Read Sensor commandssend out sensor values • Operations like “Divide”send out result values • Data flows through wires Value = 75 Value = Sound Sensor Reading Value = Ultrasonic Sensor Reading divided by 2
Data Flow • Data is used by commands and Structures Motor power set to 75 Motor power set to Sound Sensor value Motor power set to Sound Sensor value divided by 2
Data Flow • Data is used by commands and Structures Repeats 8 times If Touch Sensor is Pressed, run this “True” pane code Repeats until Port C Rotations exceed 1800 degrees
Front Panel Data • The Front Panel can provide and display data • Controls generate values that can be used in code • Indicatorsdisplay values in different ways
Data Flow • Every command in LabVIEW runs as soon as all its “incoming” data is ready • The NXT Pink Wire is actually just a creative use of Data Flow to create sequences of commands that have to wait for one another
Data Flow: Parallelism • Every command in LabVIEW runs as soon as all its “incoming” data is ready • This even lets multiple code strands run at once!
Controlling Program Flow • Structures can control when commands run • Sequence Structures force groups of commands to run in a certain order
Controlling Program Flow • Structures can control when commands run • Case Structures choose alternative sets of code to run, based on an input value
Controlling Program Flow • Structures can control when commands run • For Loops repeat code a set number of times
Controlling Program Flow • Structures can control when commands run • While Loops repeat code until a wired Stop condition is reached
Control Loops • Control Loops are a strategic arrangement of a Case and a Loop • Repeats a decision quickly so it looks “continuous”
Shift Registers • Shift Registers pass values across loop cycles • This allows values to “accumulate” or “count up”