Download Lab Experiment No. 11 Using the MSP430 to Control LEDs With a

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Current source wikipedia , lookup

Control system wikipedia , lookup

Rectifier wikipedia , lookup

Solar micro-inverter wikipedia , lookup

Buck converter wikipedia , lookup

Two-port network wikipedia , lookup

Power electronics wikipedia , lookup

Resistive opto-isolator wikipedia , lookup

Integrating ADC wikipedia , lookup

Switched-mode power supply wikipedia , lookup

Analog-to-digital converter wikipedia , lookup

Schmitt trigger wikipedia , lookup

Current mirror wikipedia , lookup

Immunity-aware programming wikipedia , lookup

Opto-isolator wikipedia , lookup

Transcript
Lab Experiment No. 11
I.
Using the MSP430 to Control LEDs
With a Force Sensor
Introduction
Microcontroller input/output functions can be used in wide variety of combinations to control and automate systems. In
this experiment, you will use the ADC on the MSP430 to read a force sensor output and control an LED array
depending on the force sensor output. The objectives of this experiment are to:
1) Control an LED array using a force sensor output.
2) Become familiar with microcontroller GPIO.
3) Become familiar with analog-to-digital conversion using a microcontroller.
II. Components, Instruments and Software
The components, instruments and software required for this lab are listed below.
Components:
3 – 100 Ω 1/4W Resistors
10 KΩ 1/4W Resistor
TI TLC274ACN Op-Amp
Green, Yellow and Red LEDs
FlexiForce 1 lb. Force Sensor
Microcontroller:
TI MSP430 LaunchPad
Software:
TI Code Composer Studio Version 5
III. Connecting Input/Output Peripherals to the MSP430
Since your MSP430 was programmed during the pre-lab, in this portion of the experiment you will connect the
input/output peripherals. The force sensor’s output will be connected to the ADC of the MSP430 and the LED array
will be connected to three GPIO pins of the MSP430. Make all connections with the power disconnected!
1) First, you will setup your resistance to voltage conversion circuit. This circuit allows the changing resistance of
the force sensor to be converted into a voltage that the ADC of the MSP430 can read. It consists of the
TLC274ACN op-amp, a 10 KΩ resistor and the FlexiForce force sensor. Connect the output of the op-amp to
P1.5 on the MSP430.
Figure1: Resistance to Voltage Circuit
2) Next, you will connect the LED array to three GPIO pins on the MSP430. The LEDs are turned on according to
the following conditions:
 Force < .5 lb. → Green LED On
 .5 lb. < Force < 1 lb. → Yellow LED On
 Force > 1 lb. → Red LED On
Figure 2: LED Array Circuit
3) Now that all of your input/output circuitry has been connected to the MSP430, double check your wiring and
connect the USB cable. Press down on your force sensor and watch the LEDs light up!
IV. Post-lab Assignment
1) Without rewiring your LEDs, edit the microcontroller code so the LED sequence is reversed: Red → Yellow →
Green as force increases.
2) Setup the ADC so that it reads from P1.4. Rewire your breadboard to reflect these changes.
3) If the voltage VADC = 1.45V is received by the ADC of the MSP430, what decimal number is it converted to
when VCC = 3.5V and VSS = 0V are used as references?
4) Using the decimal number calculated above, modify your code so that this is used as the force > 1lb. output
condition.
Be sure to attach your modified source code in an appendix to your lab report and email your source code file
‘example.c’ to me ([email protected]) and Dr. Popa.s