DOC PREVIEW
CU-Boulder ECEN 4517 - Lecture Notes

This preview shows page 1-2-3-23-24-25-26-46-47-48 out of 48 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 48 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 48 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 48 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 48 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 48 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 48 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 48 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 48 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 48 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 48 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 48 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

ECEN 45171ECEN 4517/5517 Lecture 2• Upcoming assignments due:• Exp. 1 final report due in D2L dropbox by 6:00 pm Friday Jan. 31• Exp. 3 part 1 prelab assignment due in D2L dropbox by Monday, Feb. 3 at 1pm• This week: Exp. 2: Introduction to MSP 430• Lab kits are available in ECEE Electronics Store, ECEE 1B10• You will need this kit to perform Exp. 2.• You will also need two oscilloscope voltage probes, as well as small parts (capacitors) from the undergraduate electronics lab parts kit.• Next week in lecture [note change of date]10 minute quiz on Exp. 1. See Exp. 1 web page for a sampleECEN 45172Lab reports• One report per group. Include names of every group member on first page of report.• Report all data from every step of procedure and calculations. Adequately document each step.• Discuss every step of procedure and calculations– Interpret the data– It is your job to convince the grader that you understand what is going on with every step– Regurgitating the data, with no discussion or interpretation, will not yield very many points– Concise is good– Annotate diagrams and plots, use consistent notationECEN 45173Upcoming weeks:Design and build MPPT systemExp. 2: introduction to MSP430 microcontrollerExp. 3: DC-DC converterECEN 45174This Week’s Experiment 2• Become familiar with MSP430• Set up your MSP 430 to drive a MOSFET at a programmable duty cycle• Discussion: online Quizzes 2.1 and 2.2ECEN 45175Introduction to MSP430ECEN 4517/5517• MSP430 microcontroller• MSP430 development board• Simple code examples• Timer D, high-resolution digital pulse-width modulation• Analog-to-Digital conversion (ADC)ECEN 45176Experiments 2 and 3Design and build MPPT systemExp. 2: introduction to MSP430 microcontrollerExp. 3: DC-DC converterECEN 45177MSP430F5172: ResourcesMSP430F5172 User’s Guide• The primary resource for operation and programming of on-chip peripherals (PWM, ADC, etc.)• Linked to Exp. 2 web page, 1147 page pdfMSP430F5172 Data Sheet• Describes pinouts, specifications• Linked to Exp. 2 web page, 103 page pdfCode Composer Studio 5.3• Development system for MSP430; program in C• On lab computers: free version (limited code size)Library of Code Examples• Accessible within Code Composer Studio, also linked to web page• Many programming examples for each peripheral• Use directory of examples for 430F5172 chip• Also: Erickson’s sample code main.c linked to Exp. 2 web pageECEN 45178Experiment 2Introduction to MSP 430F5172 MicrocontrollerProgrammable multi-use I/O ports (31)32-bit multiplierTimer D (2)Timer A (1)10-bit A/DAnalog comparatorVoltage referenceClocks: ACLK, SMCLK, MCLKUp to25 [email protected]:16 bitECEN 45179Microcontroller PinoutTimer DPWM outputs[to LED (P1.0 output)Px.y is digital I/OADC inputsA0 to A5, A7, A8PM_TD0.xPM_TD1.xSee also pins 20, 23-28, 33[JTAGprogrammerECEN 451710Microcontroller default settingsUpon power-on reset (POR), the MSP430F5172 comes up with the following conditions:• Watchdog timer is enabled• All pins are set to read state• Processor internal clock and core voltage are set to minimum values. Default clock frequency = 1.045 MHz• Processor supply voltage is 3.3 V• Internal processor core operates at lower voltage; a programmable internal voltage regulator reduces the 3.3 V to this lower voltage• Faster clock speeds require higher core voltages• Digital I/O pins can operate at 5 V if 5 V is supplied to DVIO pin. Otherwise, these pins operate with 3.3 V logic levels. In the lab, we will always work with 3.3 V supply and 3.3 V logic levels.ECEN 451711Development boardin your kitJTAG(to computer)ExternalpowerJumper:Select power source—JTAG (as shown) or externalHeader:Processorpins 20-38Header:Processorpins 1-19Jumper:Select digital I/O power—Internal 3.3 V (place jumper to short 1-2, as highlighted), or external 5 VJumper:Connect or disconnect LED from P1.0Reset buttonECEN 451712Development board schematic: header pinout(complete board schematic linked on the Exp 2 page)ECEN 451713Peripherals are controlled by registers in addressable memoryExample: Port P1, comprised of eight pins labeled P1.0 – P1.7. Digital input/outputFor further documentation, see MSP430x5xx/6xx Family User Guide, Ch 12, pp. 406ffThere are additional P1 registers related to interrupts.TI provides a header file that sets up all registers with C code variable names assigned to the correct addresses. Just add the following statement to the beginning of your C code:#include <msp430f5172.h>This file also defines constants that are useful for setting peripheral functions.Read input valueWrite output value0 = input1 = output0 = GPIO1 = selected for peripheral moduleWhen input, 1 = pullup/down0 = reduced1 = full driveECEN 451714Simple Code ExamplesConfigure pin P1.0 to be a digital output, and toggle its valueP1DIR |= 0x01; // OR the contents of register P1DIR with hex 01, // forcing the first bit high// This configures pin P1.0 to be an outputP1OUT ^= 0x01; // EXOR the contents of P1OUT with hex 01,// toggling the first bit// This changes the state of logic output P1.0Turn off the watchdog timerWDTCTL = WDTPW + WDTHOLD; // Sets the WDT control register WDTCTL to // disable the watchdog timer function// WDTPW and WDTHOLD are constants defined// in the header file supplied by TI—see user guideECEN 451715C code to toggle pin P2.2Code example: drive P2.2 (pin 19) with a low-frequency square wave. The development boards have an LED connected to P1.0; if the code is modified to drive P1.0 then it will blink the LED. This is your Task 1 in Exp 1.#include <msp430.h>/** main.c* Drive pin P2.2 with a low‐frequency square wave*/void main(void ) {volatile unsigned int i; // Declare counter variableWDTCTL = WDTPW | WDTHOLD;// Stop watchdog timerP2DIR |= 0x04; // Configure pin P2.2 to output directionfor (;;) { // Infinite loopP2OUT ^= 0x04; // Toggle P2.2 outputi= 10000;do(i‐‐);while(i != 0); // Wait 10000 cycles}}ECEN 451716Introduction to MSP430ECEN 4517/5517• MSP430 microcontroller• MSP430 development board• Simple code examples• Timer D, high-resolution digital pulse-width modulation• Analog-to-Digital conversion (ADC)ECEN 451717Digital pulse-width modulationusing MSP430 Timer DTD0CCR0TD0CCR1Ts= nTclkTclkSwitching period = Ts= 1/fs= nTclk, duty cycle D = k/nfclk= 200 MHz = TDCLK frequency, Tclk= 5 nsDTs= kTclkk= TD0CCR1+1n = TD0CCR0+1TDR counter (up mode) ttTD0.1 output (reset/set mode)ECEN


View Full Document

CU-Boulder ECEN 4517 - Lecture Notes

Documents in this Course
Lecture 2

Lecture 2

24 pages

Lecture 4

Lecture 4

16 pages

Lecture 2

Lecture 2

48 pages

Lecture 1

Lecture 1

23 pages

Lecture 6

Lecture 6

26 pages

Battery

Battery

27 pages

Lecture 3

Lecture 3

20 pages

Lecture 4

Lecture 4

23 pages

Load more
Download Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?