Sunteți pe pagina 1din 5

Assignment 1

Circuit Calculator - Due Week 3


Bring to lab on thumbdrive to give to your labsection TA
Your first assignment is to construct a program which performs simple circuit calculations: The program
will be given a CONSTANT value of 5 volts for the power source. Additionally the program will have two
input CONTROLS for two resistors, R1 and R2, which will be used in the calculations. The calculator will
use the CONSTANT and the two CONTROLS to calculate: Equivalent resistance of the two resistors in
parallel as well as the current, power, and equivalent resistance of a circuit with the resistors in series. You
are also to create a set of three lights on the front panel which indicate whether R1 is greater than R2, R1
equals to R2, and is if the circuit is shorted.
The expressions to be computed are:

Example front and back panels, which perform the required functions, are shown below. Note that there
are various methods you may use to complete each assignment. Your programs may look completely
different than the examples and receive full credit, so long as they perform the required tasks.

The pseudo-code for this program is given:


Reg

parallel

Reg

series

= 1 /((1/R1)+(1/R2));

= R1 + R2;

Iseries = 5/Reg

series;

rrrrrrrrrrrrrrrrrrrrrrrrrrr
rrrrrrttttttttttttt
Pseries = rrrrrrrrrrrrrrrrrrrrrrrrrr
5
* (I
)^2;
Req
series
* Iseries
series
R

^2

if R1 = 0 && R2 = 0
Short_circuit_LED = TRUE;
if R1 > R2
Greater_LED = TRUE;
If R1 = R2
Equal_LED = TRUE;
end

Helpful Concepts:
Context Help
This is a feature of LabVIEWwthat explains how LabVIEW functions operate. When you mouse over a function,
the help for that function is displayed in the context help box.
You can get context help by pressing Ctrl + H on the keyboard, or by clicking on the help menu, and selecting
Show Context Help

Here the help for the Add function is displayed. The values for x and y are wired to the function, and the sum is
wired out. By convention, inputs are on the left side of functions, and outputs are on the right.

Front Panel / Block Diagram


All LabVIEW programs have a front panel and a block diagram (also called a back panel). When you create a
new program, both are created automatically, and when you save your program, both are saved. You can switch
from one to the other by pressing Ctrl + E.
Block Diagram

Front Panel

The front panel provides an interface which allows the user to interact with the program. Controls, such as knobs,
slide bars and menu boxes allow the user to supply information to the program. Indicators, including graphs and
dials, supply information to the user about the state of the program.

The block diagram is where all of the programming takes place. Here, functions are connected together by wires,
in a manner similar to a circuit diagram. Whenever a control or indicator is placed on the front panel, an
corresponding icon is automatically created on the block diagram. In the case of an indicator, data is wired to the
icon on the block diagram and displayed on the front panel. For controls, data is wired from the control icon, and
used elsewhere in the program.

Controls, Indicators and Constants


Data can be supplied to LabVIEW in two forms: Controls and constants. A control is something that can be
changed while the program is running, and it has some type of icon on the front panel which the user manipulates
to provide the input. A constant is provided during programming, but cannot be changed at run time.
LabVIEW returns data to the user as indicators. These can be altered by the program while it runs, but cannot be
changed by the user.

Automatically Creating Inputs and Outputs


There are two ways to find the constants, controls and indicators that you need for your functions: the easy way
and the hard way. The hard way is to search through all of the menus until you get what you are looking for.
This can take a long time, and has been known to cause pulling of hair and gnashing of teeth.
The easy way to get the input or output that you are looking for is to have LabVIEW create it for you. This is a
sure way to speed up the programming process, and save yourself a lot of frustration.
To have LabVIEW create an input or output, first put a function on the block diagram, then right click on the
terminal you want to connect to, point to create, and choose constant, control or indicator.

Remember, inputs can only be constants or controls, and outputs can only be indicators.

Run Button
The small arrow in the upper left corner of the window is the run button. When this button is white, it means that
there are no errors in your vi, and it is ready to run. If you click on the arrow when it is white, it will run your
program.
When the arrow is gray with and appears broken, it means that your program has errors in it. Rather than
searching for the errors yourself, it is often easier to have LabVIEW find them for you. To do this, click on the

broken run arrow. LabVIEW will display a list of all the errors in your program. LabVIEW will even find the
location of each error: double click an item on the list, and LabVIEW will highlight its location in your code.

Run Arrow No Errors

Run Arrow Broken, with errors

Show a list of errors by clicking on the broken run arrow

Helpful Video Tutorials


Finding function and Vis

S-ar putea să vă placă și