dan o. popa, freshman practicum, spring 2015 ee 1106 : introduction to ee freshman practicum...

20
Dan O. Popa, Freshman Practicum, Spring 2015 EE Freshman Practicum Lab-Lecture: Nonlinear circuit elements, LABVIEW review and MSP 430 Programming

Upload: emerald-pierce

Post on 25-Dec-2015

222 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Dan O. Popa, Freshman Practicum, Spring 2015 EE 1106 : Introduction to EE Freshman Practicum Lab-Lecture: Nonlinear circuit elements, LABVIEW review and

Dan O. Popa, Freshman Practicum, Spring 2015

EE 1106: Introduction to EEFreshman Practicum

Lab-Lecture: Nonlinear circuit elements, LABVIEW review and

MSP 430 Programming

Page 2: Dan O. Popa, Freshman Practicum, Spring 2015 EE 1106 : Introduction to EE Freshman Practicum Lab-Lecture: Nonlinear circuit elements, LABVIEW review and

Dan O. Popa, Freshman Practicum, Spring 2015

Nonlinear Circuit Elements- Transistor

Image Sources: Textbook

Page 3: Dan O. Popa, Freshman Practicum, Spring 2015 EE 1106 : Introduction to EE Freshman Practicum Lab-Lecture: Nonlinear circuit elements, LABVIEW review and

Dan O. Popa, Freshman Practicum, Spring 2015

The Operational AmplifierThe op amp is built using VLSI techniques. The circuit

diagram of an LM 741 from TI is

shown below.

Vcc+

Vcc-

Vo

Vn(-)

Taken from TI data sheet as shown on the web.

Vp(+)

Page 4: Dan O. Popa, Freshman Practicum, Spring 2015 EE 1106 : Introduction to EE Freshman Practicum Lab-Lecture: Nonlinear circuit elements, LABVIEW review and

Dan O. Popa, Freshman Practicum, Spring 2015

Transistor use: Digital Inverter

Page 5: Dan O. Popa, Freshman Practicum, Spring 2015 EE 1106 : Introduction to EE Freshman Practicum Lab-Lecture: Nonlinear circuit elements, LABVIEW review and

Dan O. Popa, Freshman Practicum, Spring 2015

D/A and A/D conversion

Page 6: Dan O. Popa, Freshman Practicum, Spring 2015 EE 1106 : Introduction to EE Freshman Practicum Lab-Lecture: Nonlinear circuit elements, LABVIEW review and

Dan O. Popa, Freshman Practicum, Spring 2015

Digital to Analog Converter (DAC)

n=4, G=-0.5

Page 7: Dan O. Popa, Freshman Practicum, Spring 2015 EE 1106 : Introduction to EE Freshman Practicum Lab-Lecture: Nonlinear circuit elements, LABVIEW review and

Dan O. Popa, Freshman Practicum, Spring 2015

Digital to Analog Converter (DAC) and the Process of Sampling

Page 8: Dan O. Popa, Freshman Practicum, Spring 2015 EE 1106 : Introduction to EE Freshman Practicum Lab-Lecture: Nonlinear circuit elements, LABVIEW review and

Dan O. Popa, Freshman Practicum, Spring 2015

Analog to Digital Converter using a DAC

Page 9: Dan O. Popa, Freshman Practicum, Spring 2015 EE 1106 : Introduction to EE Freshman Practicum Lab-Lecture: Nonlinear circuit elements, LABVIEW review and

Dan O. Popa, Freshman Practicum, Spring 2015

Analog to Digital Converter (ADC)Sample and Hold Circuit

Page 10: Dan O. Popa, Freshman Practicum, Spring 2015 EE 1106 : Introduction to EE Freshman Practicum Lab-Lecture: Nonlinear circuit elements, LABVIEW review and

Dan O. Popa, Freshman Practicum, Spring 2015

Texas Instruments MSP430 LaunchPad

• The LaunchPad development board features:

– 14-/20-pin DIP (N) socket – Built-in flash emulation for

debugging and programming – 2 programmable LEDs – 1 power LED – 1 programmable button – 1 reset button

• Includes one mini USB cable to interface with a PC.

• MSP430G2553IN20 – 16kB Flash, 512B RAM, interruptible GPIOs (capacitive sense-capable), 16-bit timers, 8ch 10-bit ADC, Comparator, Serial Communication (USCI – I2C, SPI & UART) & more

10

Programming Constructs

Data Types-Primitives (Integer, Float, etc)-Const, Var, Pointer-Complex (Lists, arrays, etc.)-Register values (tied to hardware)-Timer (clocks, tied to hardware)

Operations on data-+, - , =, etc.

Control Statements

- If, case (conditional)

- While, For (loops)

Function calls-User defined-Main ()-MSP 430 specific: ex. ConfigureADC

Page 11: Dan O. Popa, Freshman Practicum, Spring 2015 EE 1106 : Introduction to EE Freshman Practicum Lab-Lecture: Nonlinear circuit elements, LABVIEW review and

Dan O. Popa, Freshman Practicum, Spring 2015

while(1)

{

ADC10CTL0 |= ENC + ADC10SC; // Enable conversion and start conversion

__delay_cycles(10000); // Delay 10000 clock cycle to allow ADC to settle

adcval = ADC10MEM; // Store ADC sampled value

if (adcval < 380) // Based on sensor input to ADC, determine which pin to turn on. These values were determined

{ // by calibrating the sensor prior to the lab. P1.0 = force < 1/2 lb, P1.1 = 1/2 lb. < force < 1 lb.

if (adcval < 205) // P1.2 = force > 1 lb.

{

P1OUT = 0x01;

}

else

{

P1OUT = 0x02;

}

}

else

{

P1OUT = 0x04;

}

}

Microcontroller Programming in C(Labs 10,11,12)

Page 12: Dan O. Popa, Freshman Practicum, Spring 2015 EE 1106 : Introduction to EE Freshman Practicum Lab-Lecture: Nonlinear circuit elements, LABVIEW review and

Dan O. Popa, Freshman Practicum, Spring 2015

LabVIEW and connection with C programming (review)

•LabVIEW programs are called:– Virtual Instruments (VIs) – because their appearance and operation

imitate actual instruments.

•However, they are analogous to main programs, functions and subroutines from popular language like C …

Page 13: Dan O. Popa, Freshman Practicum, Spring 2015 EE 1106 : Introduction to EE Freshman Practicum Lab-Lecture: Nonlinear circuit elements, LABVIEW review and

Dan O. Popa, Freshman Practicum, Spring 2015

Abstraction: LabVIEW Programs Virtual Instruments (VIs) vs. C programs

• Front Panel• Controls = Inputs• Indicators = Outputs

• Block Diagram• Accompanying “program”

for front panel• Components “wired”

together

Page 14: Dan O. Popa, Freshman Practicum, Spring 2015 EE 1106 : Introduction to EE Freshman Practicum Lab-Lecture: Nonlinear circuit elements, LABVIEW review and

Dan O. Popa, Freshman Practicum, Spring 2015

Abstraction: Dataflow Programming

• In this case, the block diagram executes from left to right, not because the objects are placed in that order, but because the Subtract function cannot execute until the Add function finishes executing and passes the data to the Subtract function.

• For C language – line by line code execution, compiled, with function calls, multithreading, etc.

Page 15: Dan O. Popa, Freshman Practicum, Spring 2015 EE 1106 : Introduction to EE Freshman Practicum Lab-Lecture: Nonlinear circuit elements, LABVIEW review and

Dan O. Popa, Freshman Practicum, Spring 2015

Primitive Modules

• The basic primitive building blocks in LabVIEW include– Numbers – formatted according to type (e.g. integer, boolean, float, etc.)– Loops – While, For– Logical and Arithmetic Ops – Comparator, Summer, Adder– GUI Elements – Button, Knob, Dial

– For C code: int, float, double declared explicitly

Page 16: Dan O. Popa, Freshman Practicum, Spring 2015 EE 1106 : Introduction to EE Freshman Practicum Lab-Lecture: Nonlinear circuit elements, LABVIEW review and

Dan O. Popa, Freshman Practicum, Spring 2015

Dataflow ProgrammingWhich VI(s) will execute first? Which VI will execute last?

Page 17: Dan O. Popa, Freshman Practicum, Spring 2015 EE 1106 : Introduction to EE Freshman Practicum Lab-Lecture: Nonlinear circuit elements, LABVIEW review and

Dan O. Popa, Freshman Practicum, Spring 2015

While Loop

while(1)

{

… }

else

{

… }

}

Page 18: Dan O. Popa, Freshman Practicum, Spring 2015 EE 1106 : Introduction to EE Freshman Practicum Lab-Lecture: Nonlinear circuit elements, LABVIEW review and

Dan O. Popa, Freshman Practicum, Spring 2015

For Loop

for (int i=1; i<=N; i++)

{

}

Page 19: Dan O. Popa, Freshman Practicum, Spring 2015 EE 1106 : Introduction to EE Freshman Practicum Lab-Lecture: Nonlinear circuit elements, LABVIEW review and

Dan O. Popa, Freshman Practicum, Spring 2015

Decisions

Case Structure Select Function

if (adcval < 205)

{

{

…}

else

{

P1OUT = 0x04;

}

}

Page 20: Dan O. Popa, Freshman Practicum, Spring 2015 EE 1106 : Introduction to EE Freshman Practicum Lab-Lecture: Nonlinear circuit elements, LABVIEW review and

Dan O. Popa, Freshman Practicum, Spring 2015

next week, focus on pressure sensors with MSP 430 and opamp

20