computer programming with labview · of labview advantages •it’s super handy to control stuff....

111
University of Nottingham Dr. Roderick MacKenzie [email protected] Spring 2017 Computer programming with LabView Released under

Upload: others

Post on 21-Apr-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of Nottingham

Dr. Roderick MacKenzie

[email protected]

Spring 2017

Computer programmingwith LabView

Released under

Page 2: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Outline of the lecture

•What is LabView and why should I know about it?

•Starting LabView

•Input and output

•Basic mathematics

•Case statements

•For loops

•While loops

•Making an LED display segment.

•Embedding code in VIs

•Controlling instruments

2

Page 3: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

The difference between a normal programming language and LabView

>r=2.0>a=3.1415*r*r>r=2.0>a=3.1415*r*r

Matlab LabView

LabView is visual its all drag and drop and programmed with the mouse.

Page 4: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

LabView is used to controlequipment

computer

USB->GPIB

To measurement system

Page 5: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

And equipment is used tocontrol a lab

Page 6: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Taking measurements in industrial settings.

6

It’s also used to control measurement equipment

computer

Page 7: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

A more simplistic example ofusing LabView

OscilloscopeD to A Voltage source

DataControlBi-

directional

Page 8: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

It can control factories, robots, basically everything

All without having to write a line of code because it’s visual

Page 9: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Advantages/Disadvantagesof LabView

Advantages

•It’s super handy to control stuff.

•You don’t really need to write computer code.

•Manufactures of ALL industrial/lab equipment provide LabView drivers.

•Super easy to interface with experimental kit.

Disadvantages

•For some tasks it can be really good, and forsome tasks it can be really bad.

•Controlling robots, good processing text, bad.

•It’s expensive 3k for one license.

Page 10: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

What will I learn today?

•The real basics of LabView.

•I want to give you exposure to it, so that if you find your self in a lab with LabView running it, you will be able to edit the code.

•The class will be totally practical based

no theory.

•If you become a manager, and never program LabView your self, I expect you will supervise people who do use it. So, it’s a good idea to know what it is.

Page 11: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

What will I not learn today?

•You are not going to be an expert in LabView

•This would take me 2-3 days of lectures.

•NI do run LabView courses with accreditation, look out for these.

•Due to the size of the class/time we can’t actually control hardware today. But it’s only a really tiny step from what we are doing today to controlling real hardware.

Page 12: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Outline of the lecture

•What is LabView and why should I know about it?

•Starting LabView

•Input and output

•Basic mathematics

•Case statements

•For loops

•While loops

•Making an LED display segment.

•Embedding code in VIs

•Controlling instruments

12

Page 13: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamStarting LabView.

Page 14: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamStarting LabView.

Page 15: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamStarting LabView.

Page 16: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamMaking a new program(these are called VIs in LabView)

Page 17: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamYou should get two windows

•This is where the ‘code’ goes.

•You can think of this as the back end.

•This is where the user interface goes.

•And this as the front end

Page 18: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamIf you close one window you can get to the other through the Window menu.

•Wight (Code)

•Grey (UI)

Page 19: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Outline of the lecture

•What is LabView and why should I know about it?

•Starting LabView

•Input and output

•Basic mathematics

•Case statements

•For loops

•While loops

•Making an LED display segment.

•Embedding code in VIs

•Controlling instruments

19

Page 20: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamBringing up the tools menu for the user interface.

Page 21: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamSelecting the user interface component you want to use.

Page 22: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamLabView has input (controls) and outputs (indicators)

Page 23: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamLabView has input (controls) and outputs (indicators)

Input Output

Page 24: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamIf you now look in the block diagram you will see that two little boxes have been made.

Page 25: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamIn the block diagram editor, bring up the tools palet.

Page 26: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamClick on the little spool of wire and join the two components.

Page 27: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamNow on the front panel, click run for ever.

Page 28: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamNow play with the number in the left hand box, what happens?

Page 29: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamClick on the stop button when you want to stop the program.

Page 30: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamSelect the pointer in the tool box, click on “Numeric 2”, and hit the delete key.

del

Page 31: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamFind the “tank”, indicator from the toolbox and drag it to the front panel.

Page 32: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamThen using the spool tool again, connect the two items with a wire.

Page 33: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamClick run forever again and have a play with the value again.

Page 34: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamTry and replace the number with a Knob from the tools menu. Try to do this your self.

Page 35: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Outline of the lecture

•What is LabView and why should I know about it?

•Starting LabView

•Input and output

•Basic mathematics

•Case statements

•For loops

•While loops

•Making an LED display segment.

•Embedding code in VIs

•Controlling instruments

35

Page 36: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamNow delete the line joining the components, using the arrow.

Page 37: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamOn the block diagram click View→Functions pallet

•Then click on the mathematics button.

Page 38: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamAnd the window should look like this..

Page 39: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamDrag and drop and x2 and a x to the block diagram.

Page 40: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamThen again with the spool tool join the knob to the x2 and the x2 to the x.

Page 41: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamRight click on the bottom terminal of the x and click “create constant”.

Page 42: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamClick on the edit tool, then click on the constant and type 3.14159

Page 43: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamNow run the program and play with the knob.

What value comes out in the indicator?

Page 44: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamAgain, use the edit tool to rename the controls.

Page 45: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamAdd in some random numbers.See if you can do this your self!

You will need a second knob.

Page 46: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Outline of the lecture

•What is LabView and why should I know about it?

•Starting LabView

•Input and output

•Basic mathematics

•Case statements

•For loops

•While loops

•Making an LED display segment.

•Embedding code in VIs

•Controlling instruments

46

Page 47: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamNow delete all the wires, so the diagram looks like this:

Page 48: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamCase statements are used to make decisions

•Make your window look like this using drag and drop

Page 49: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamNow from the block diagram editor window, make a toggle switch.

Page 50: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamYou should have something that looks like this.

Page 51: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamAgain using the wiring tool join up the button to the case statement.

Page 52: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of Nottingham

Now using the wiring tool and the x from the tool box make your diagram look like this.

Page 53: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamNow click here to look at the code which runs when the false conditions is met.

Page 54: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamNow run the code and have a play with it.

Page 55: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamLet’s add an LED indicator just for fun.

Page 56: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamAnd now wire it up with the bobbin again!

Page 57: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamAnd run it and have a play!

Page 58: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Outline of the lecture

•What is LabView and why should I know about it?

•Starting LabView

•Input and output

•Basic mathematics

•Case statements

•For loops

•While loops

•Making an LED display segment.

•Embedding code in VIs

•Controlling instruments

58

Page 59: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamFor loops in matlab

(Maybe go through loops on the board)

Indicates the number of times the code runs.

Page 60: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamCreate a numerical constant, it will tell the computer how many times to run the code.

Page 61: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamIt should look like this

Page 62: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamUse the editor to change the value to 10.

Page 63: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamPlace a random number generator in the for loop.

Page 64: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of Nottingham

Now place a slider in the front panel make sure the icon in the block diagram is in the for loop box.

Page 65: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamNow connect the random number generator to the indicator.

•Note I’ve changed my indicator to a meter (just for fun!).

•And click Run once.

•What happens?

Page 66: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamOK so let’s add a timer to slow things down.

Page 67: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamHover over this with the bobbin tool selected

Page 68: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamRight click and make a constant.

Page 69: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamSet the value to 1000 because it’s ms and run it again.

Page 70: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Outline of the lecture

•What is LabView and why should I know about it?

•Starting LabView

•Input and output

•Basic mathematics

•Case statements

•For loops

•While loops

•Making an LED display segment.

•Embedding code in VIs

•Controlling instruments

70

Page 71: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamSo, let’s start over, and delete every thing.

Page 72: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamThis time instead of using a for loop, let’s use a while loop.

Page 73: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamWhile loops run forever until they are told to stop.

•This is the button that tells the while loop to stop.

•Click create control.

Page 74: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of Nottingham

This tells us how many times the while loop has run, to view the value click create indicator.

Page 75: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamClick the run once button. And then hit the stop button when you want it to stop.

•How quickly can you stop it

•What’s the lowest number you can get it to count to?

Page 76: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamIn class exercise: Try to make this little program.

Page 77: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamThis is what it should look like.

Page 78: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Outline of the lecture

•What is LabView and why should I know about it?

•Starting LabView

•Input and output

•Basic mathematics

•Case statements

•For loops

•While loops

•Making an LED display segment.

•Embedding code in VIs

•Controlling instruments

78

Page 79: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamFind the square LED from the ‘Modern’menu

Page 80: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamNow make it bigger andarrange it like this

Page 81: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamYou should end up with somethinglike this

Page 82: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamIn your block diagram you should have7 LED indicators

Line them up.

Page 83: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamNow find the case structure again.

Page 84: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamAnd make your window look like this.

Page 85: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamFind the ‘true constant’ in the menu.

Page 86: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamAnd make 7 copies of the true constant.

Page 87: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamNow wire each true constant toa display element

Page 88: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamAdd a numeric control and wire it up.

Page 89: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamRight click on here and click‘add case after’

Page 90: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamNow, it’s your job to make the rest of the segments work.

Page 91: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Outline of the lecture

•What is LabView and why should I know about it?

•Starting LabView

•Input and output

•Basic mathematics

•Case statements

•For loops

•While loops

•Making an LED display segment.

•Embedding code in VIs

•Controlling instruments

91

Page 92: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Now using the arrow make a second copy of your program.

Page 93: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Rearrange the Front Page so it looks like this

Page 94: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

University of NottinghamNow make a new VI

Page 95: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Make one control and two outputs

Page 96: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Using the edit tool, rename them.

Page 97: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Now using the math pallet, make the block diagram look like this.

What does the program do?

Page 98: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Let’s give the program an icon.

Page 99: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Make it look pretty, I’m sure you can do better than me.

Page 100: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

It should now look like this.

Page 101: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Now save it, I would call it split.vi

Page 102: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Go back to the from panel

Page 103: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Wire up the connectors.

Page 104: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Save it again.

Page 105: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Now find the VI using the file manager and drag and drop it into your main program.

Page 106: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Drag and drop.

Page 107: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Wire it up.

Page 108: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

And you should have a working two segment display.

Page 109: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Outline of the lecture

•What is LabView and why should I know about it?

•Starting LabView

•Input and output

•Basic mathematics

•Case statements

•For loops

•While loops

•Making an LED display segment.

•Embedding code in VIs

•Controlling instruments

109

Page 110: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Controlling robots...

Page 111: Computer programming with LabView · of LabView Advantages •It’s super handy to control stuff. •You don’t really need to write computer code. •Manufactures of ALL industrial/lab

Roderick MacKenzie Computer Programming with MATLAB

Outline of the lecture

•What is LabView and why should I know about it?

•Starting LabView

•Input and output

•Basic mathematics

•Case statements

•For loops

•While loops

•Making an LED display segment.

•Embedding code in VIs

•Controlling instruments

111