240 likes | 407 Views
Digital Electronics and Computer Interfacing PH 534. Tim Mewes Spring 2011. Digital Electronics. Binary systems with two possible values (logic states): High/Low ON/OFF 1/0 TRUE/FALSE First part of the course, after introduction to LabVIEW. Computer interfacing.
E N D
Digital Electronics and Computer Interfacing PH 534 Tim Mewes Spring 2011
Digital Electronics • Binary systems with two possible values (logic states): • High/Low • ON/OFF • 1/0 • TRUE/FALSE • First part of the course, after introduction to LabVIEW Digital Electronics and Computer Interfacing
Computer interfacing • Connects the digital world to the analog world • One way to communicate with Laboratory equipment is by using GPIB-commands (General Purpose Instrumentation Bus) • Data acquisition cards (DAQ-cards) provide another interface between the computer and the outside world • Second part of the course Digital Electronics and Computer Interfacing
1. LabVIEW Basics 1.1 Front panel 1.2 Block diagram 1.3 Getting help 1.4 Debugging Experiment #1 Digital Electronics and Computer Interfacing
Block diagram: contains the graphical program code Front panel: the interface to the program 1. LabVIEW Basics <CTRL>-E switches between Block diagram and Front panel Together these two parts constitute a Virtual Instrument – short: VI A VI is typically build by using other VIs which are then called subVIs Digital Electronics and Computer Interfacing
Pull-down menus Window title VI icon (right click for short cut menu) Toolbar Area that holds controls/indicatorsenables user interaction (Numeric) indicator: Displays data (Numeric) controls: Enable the user to enter data 1. LabVIEW basics 1.1 Front panel Digital Electronics and Computer Interfacing
1. LabVIEW basics 1.1.1 Front panel toolbar show/hide context help resize objects pause/resume button run continuously button align objects distribute objects text settings reorder objects abort execution button run button broken run button indicates coding errors indicates running top level VI indicates that a VI caller is running Digital Electronics and Computer Interfacing
1. Numeric controls & indicators 2. Boolean controls & indicators 3. String & Path controls & indicators 2 1 4 3 4. Array, Matrix & Cluster controls & indicators 5 5. Graphs (indicators) 1. LabVIEW basics 1.1.2 Controls palette • right clicking in an empty area of the front panel opens the controls palette • choose the general type of control/indicator: Digital Electronics and Computer Interfacing
from the submenu choose the desired control/indicator • place the object on the front panel: left click • type in a name for the control, finish with or by clicking on an empty spot of the front panel avoid using generic names like “Numeric”! 1. LabVIEW basics 1.1.2 Controls palette • right clicking in an empty area of the front panel opens the controls palette • choose the general type of control/indicator: 1. Numeric controls & indicators 2 1 4 3 5 Digital Electronics and Computer Interfacing
changes a control into an indicator and vice versa • opens the properties dialog box 1. LabVIEW basics 1.1.3 Short cut menus • right clicking in different areas of a control opens • different short cut menus Can be used to change the default value, data range, label, documentation and many more properties of objects. Digital Electronics and Computer Interfacing
opens the icon editor: • shows the connector pane of the VI the connector pane is used to define inputs and outputs of subVIs (will be discussed in detail later) 1. LabVIEW basics 1.1.4 VI icon and connector pane • right click on the icon opens the short cut menu • always design your own icon for your VIs avoid using the standard icons! • many times you will only see the icon of your VIs Digital Electronics and Computer Interfacing
Copy from: Copies from a color icon to a black and white icon and from a black and white icon to a color icon. Pencil: Draws and erases pixel by pixel. Line: Draws straight lines. Color Copy: Copies the foreground color from an element in the icon. Fill: Fills an outlined area with the foreground color. Rectangle: Draws a rectangular border in the foreground color. Filled Rectangle: Draws a rectangle with a foreground color frame and filled with the background color. Select: Selects an area of the icon to cut, copy, move, or make other changes. Text: Enters text into the icon. Double-click this tool to select a different font. While text is active, you can move the text by pressing the arrow keys. Foreground/Background: Displays the current foreground and background colors. Click each rectangle to access a color picker from which you can select new colors. 1. LabVIEW basics 1.1.5 Icon editor Digital Electronics and Computer Interfacing
Scrolling Tool Breakpoint Tool Probe Tool Color Copy Tool Coloring Tool Operating Tool Positioning/Resizing Tool Labeling Tool Wiring Tool Shortcut Menu Tool 1. LabVIEW basics 1.1.6 Tools palette • <SHIFT> + right-click or select it in the “View” pull-down menu • Used to modify the cursor appearance and its functionality Automatic Selection Tool (off):Keep it on! <SHIFT>+<TAB> turns it back on Digital Electronics and Computer Interfacing
Pull-down menus Window title VI icon (right click for short cut menu) This is where the program code is “written” Toolbar wire Indicator terminal function node Control terminals 1. LabVIEW basics 1.2 Block diagram Digital Electronics and Computer Interfacing
1. LabVIEW basics 1.2.1 Block diagram toolbar retain wire values saves data values Step Over executes a node and pauses at the next node Step Out finishes executing the current node and pauses debugging features Highlight execution button enables/disables execution highlighting data flow will be visible Step Into opens a node and pauses Execution highlighting enabled Digital Electronics and Computer Interfacing
1. Structures (For Loop, While Loop, Event Structure, etc.) 1 2 3 4 2. Array functions (Array size, Index Array, Build Array, etc.) 5 7 6 3. Cluster & Variant functions 4. Numeric functions (Add, Subtract, Multiply, etc.) 5. Boolean functions (AND, OR, XOR, etc.) 6. String functions (String length, Concatenate Strings, etc.) 8 7. Comparison functions (Equal, NOT equal, greater, etc.) 8. Instrument I/O (Data acquisition & interfacing) 9. User Libraries (your own VIs) 9 1. LabVIEW basics 1.2.2 Functions palette • right clicking in an empty area of the block diagram opens the functions palette • choose the general type of node you want to insert: • place the actual object on the block diagram Digital Electronics and Computer Interfacing
1. LabVIEW basics 1.2.3 Wiring objects • once you move the cursor over an input (or output) terminal it changes to the wiring tool • left click starts a wire • moving the mouse creates a wire (dashed line) • left click again over an output (or input) terminal Digital Electronics and Computer Interfacing
1. LabVIEW basics 1.2.3 Wiring objects • wiring errors are indicated by broken wires • moving the wiring tool over a broken wire displays a tip strip that describes why the wire is broken • <CTRL>-B removes all broken wires on the Block diagram Digital Electronics and Computer Interfacing
Left Click To Select Wires 1. LabVIEW basics 1.2.3 Wiring objects Wiring “Hot Spot” Clean Up Wiring Digital Electronics and Computer Interfacing
1. LabVIEW basics 1.2.4 Short cut menus • right clicking on terminals, function nodes and wires opens different short cut menus • terminals: - find the corresponding object on the front panel - hide the corresponding object on the front panel - change the properties of the object etc. • function nodes: - create a constant, control or indicator for • a particular input or output – very useful • etc. • wires: - create a constant, control or indicator • - clean up the wire • - set/clear breakpoints etc. Digital Electronics and Computer Interfacing
1. LabVIEW basics 1.3 Help • <CTRL>+H, or “Show Context Help” from the Help pull-down menu toggles the Context Help on and off • Move the cursor over the Block diagram object you are interested in • Using <CTRL>+?, F1 or “Search the LabVIEW…” from the Help pull-down menu you can get more detailed help • Besides help for different LabVIEW components tutorials are also available (PDF-files) try for example to search for “getting started how-to” • Use “Find examples” from the Help pull-down menu to find example VIs for a specific task • Make yourself familiar with the LabVIEW help! Digital Electronics and Computer Interfacing
Locating errors: • Click on broken Run button: a Window that explains the error and possible solutions appears Execution Highlighting: • Click on Execution Highlighting button; data flow is animated using bubbles. Values are displayed on wires. Probes: • Right-click on wire to display probe and it shows data as it flows through wire segment • You can also select Probe tool from the Tools palette and click on the wire • If retain wire values is on the last data flowed through the wire at the last VI execution is shown immediately 1. LabVIEW basics 1.4 Debugging Digital Electronics and Computer Interfacing
1. LabVIEW basics 1.4 Debugging Break points: • Right-click on a wire or node to set/clear a break point Continue execution until the next break point or the end of the program Step Into opens a node and pauses Step Over executes a node and pauses at the next node Step Out finishes executing the current node and pauses Digital Electronics and Computer Interfacing