Home

EE-Micro-Controller Design & Formal Report

image

Contents

1. U U Ww N oone 3 f s LM4F120 DSC LaunchPad pg7 D7 DP PA4 LEO PA5 LE1 PA6 LE2 PA7 LES 33 SW1 u T PF4 Fig 2 Connection to 7 Segment Display GND Part 1c Analog to Digital Converter optional In this experiment we will use one ADC module to sample the voltage across the pot shown in Fig 2 The sampled voltage will be converted to a hex value and displayed on the display board For a full resolution 1 e 12 bits we will need three 7 segment displays LM4F120 MCU has two 12 bit ADC modules Each module is controlled by a number of registers and offers a variety of options The module has four sequencers For simplicity we will use only sequencer 3 since it captures only one sample per trigger and stores the sample into the corresponding FIFO p 755 The sampling rate can be varied from 125 ksps to 1 Msps The 3 EE CME 392 Laboratory 4 4 initialization and configuration instructions for the ADC module can be found on p 770 of the datasheet Some key registers are described below SYSCTL_RCGCADC to enable clock for ADC module p 322 ADCO PC to select sampling rate p 840 use 125ksps ADCO ACTSS to select the sample sequencer 3 p 774 ADCO EMUxX to set the trigger mode p 785 trigger by processor ADCO SSMUX3 to select the ADC channel p 825 select channel 0 ADCO SSCTL3 to configure the sequencer clock p 82
2. Control The task is to remotely control the intensity of a lamp in four steps Hint You might use PWM or you might control current using two or more output pins The remote control might be one of the following USB keyboard TV remote control flashlight laser pointer not recommended sound control or any other suitable device Develop a procedure to assess the range and reliability of your design Frequency Counter The task is to measure the frequency of a 0 5 V square wave input signal in the frequency range 100 Hz to 2000 Hz and use the two digit 7 segment display to indicate the frequency The only requirement on the frequency display is that it be monotonic with input voltage Develop a procedure to verify system operation and that the measurement 1s monotonic Stepper Motor Control This task is to operate a stepper motor using a microcontroller Seven 6 wire motors are available for use UPC Bar Code Reader This task is to read the first digit of the manufacturer code and display on one 7 segment readout used in Part Ib Some UPC bar code information can be found here http www morovia com education symbology upc a asp Student s Own Task Students are encouraged to propose their own experiment References 1 Stellaris LM4F120 LaunchPad User Manual SPMU289A Revised December 2012 http www ti com tool sw ek lm4f1 20x 2 LM4F120HS5QR Datasheet Aug 29 2012 http Awww ti com lit gpn Im4fl 20h5
3. 6 disable TSO DO enable IEO ENDO Once SYSCTL RCGCADC is configured a delay of 3 5 system clocks must be added for the clock to settle down It is recommended to use two dummy operations as done before The sample sequencer must be disabled before configuring Once properly configured it is enabled again The ADC is triggered by writing 0x0008 to ADCO PSSI register p 796 When the conversion is done bit 3 of ADCO_RIS register is set to 1 by the hardware So by polling this bit we will know when the conversion is complete After conversion the 12 bit ADC result is available from ADCO_SSFIFO3 register p 810 It is important to note here that the reference voltages for the ADC module can be adjusted using VREFP pin 2 of MCU and VREFN pin 3 of MCU see p 762 of datasheet however these two pins cannot be accessed using the LaunchPad where they are internally tied to 3 3V and ground respectively see p 21 in 1 Using the code template provided on the course website write a C program to repeatedly sample the voltage across the pot connected to port PE3 Vary the pot and observe the displayed output Verify correct operation by creating a map of display output versus input voltage Take five readings from the display and find the average quantization error Part 2 Student s Own Design The second part of this experiment allows for more advanced design using a microcontroller and the results of Part I Students should
4. FO PE4 PD2 PC5 RST PE5 PD3 Pce PB7 PB4 6 PE 1 PC7 PB6 PA5 PE2 PD6 PA4 PAG PE3 PD7 PA3 PAT PFI PF4 PA2 Fig 1 Header pins on the LaunchPad EK LM4F120XL EE CME 392 Laboratory 4 3 Part 1b Display system using 7 segments lt 2 hours In this experiment we will program the LaunchPad and four digit 7 segment display module to display UOFS In addition when SW1 is pressed the display is to flash the letters H E L L O one at a time then settle back to UOFS All display segments should be turned off with a noticeable delay between the display of each letter Note carefully the diagram of the display module Obtain other components shown in Fig 2 and connect the circuit The LaunchPad board is sufficient to supply 5 V to Vdd of the 7 segment display module connect the display power pins directly to VBUS and GND of J3 For now you may omit the pot required for Part 1c The experiment uses C language to program the MCU Using the code template provided on the course website write a program to accomplish the task You will need to open a new project on Keil uVision4 Note that display latches are connected to PA4 PA7 Using the Latch Enable LE pin your program can update the display digits one at a time O 5V 3 3V 3 3 V VBUS 5V POT PE3 AINO pE p PBO DO g PB1 D1 f
5. UNIVERSITY OF SASKATCHEWAN EE CME 392 Laboratory 4 Designing with a Microcontroller EE v4 Safety In this lab voltages are less than 15 volts and this is not normally dangerous to humans However you should assemble or modify a circuit when power is disconnected and don t touch a live circuit if you have a cut or break in the skin Objective This lab provides an opportunity to learn about the use of a microcontroller MCU and its interfacing to external devices The lab uses the Stellaris LM4F120 LaunchPad that has an ARM Cortex M4F LM4F120HSQR MCU in it The lab has two parts Part I of lab provides and introduction and then uses C language programming to drive a 7 segment display Part II builds on the first part and the student is to design a microcontroller solution to solve one of several tasks Background The LM4F120 is a 32 bit ARM Cortex M4F microprocessor that runs at 80 MHz with 256 kB flash memory 32 kB RAM 43 programmable general purpose I O GPIO ports two 12 bit ADC modules and 12 general purpose timers Like most microcontrollers the I O ports in LM4F120 are memory mapped To increase the readability of the code we will use symbolic definitions for these ports For example GPIO PORTF DATA points to the memory location 0x4002 53FC that holds the status or data of Port F see in the sample code how it 1s done Note that these definitions are user defined While declaring these definitions the app
6. ce the LaunchPad is powered from it For other power options consult p 11 of the user manual 1 Press the RESET button must do after every download then press SW1 active low and observe the LED flashing active high Now study the starter code starter _0 c and the comments after every line it will help you better understand the code syntax and configuration of LM4F120 MCU The code is to simply turn on the onboard red blue and green LEDs in sequence when the switch SW1 is pressed The switch and LEDs are all connected to Port F LaunchPad Interface Before you go to the next section and build your circuit you should carefully note the non sequential pin out diagram of the LaunchPad shown in Fig 1 Although the LM4F120HSQR MCU has 43 GPIO only 35 of them are available through the LaunchPad They are 6 pins of Port A PA2 PA7 8 pins of Port B PBO PB7 4 pins of Port C PC4 PC7 6 pins of Port D PDO PD3 PD6 PD7 6 pins of Port E PEO PE5 and 5 pins of Port F PFO PF4 In addition there are two ground one 3 3V one 5V VBUS and one reset pins available on the LaunchPad Pins PCO PC3 are left off as they are used for JTAG debugging Pins PAO PAI are also left off as they are used to create a virtual COM port to connect the LaunchPad to PC These pins should not be used for regular I O purpose J J J4 J2 3 3v VBUS PF2 GND PB5 GND PF3 PB2 PBO PDO PB3 PEO PBi PD1 PC4 P
7. me a D Single Pos 344 ms e Add Channel Mode Normal v Type Level 1 1 X 100 ms div Base C1 E 2012 12 14 21 57 50 875 8192 Samples at 8 kHz 125 us Ae 2 5V y Offset ov Range 500 mV div 4 Kellrggs Rice Krispies 12 oz Analog Out Baso 20 ms div i a 00 031846 7 Information on UPC structure http www morovia com education symbology upc a asp Details on UPC code http www wikihow com Read 12 Digit UPC Barcodes Documents on a representative handheld UPC scanner wand can be found here http www currentdirections com hardware honeywell st6100 html END
8. ngton transistor array that includes snubber diodes Unfortunately the high Darlington saturation voltage Vcr gt 1 0 V results in excessive heat dissipation in the package There are 3 modes of driving the motor see Stepper Basics in 3 Illustrated below are gate control waveforms for the standard high torque regime Can you change the direction of the motor How would you change the speed of rotation O 12V White Yellow a m Z Ee RB Soy 03 Unipolar Drive 30Q coils T E aa E aa 2 LLL AAW Standard Drive IFL2703 1 http www robotshop com ca rbsoy03 soyo unipolar stepper motor html 2 http www datasheetarchive com IRL2703 datasheet html 3 http www robotshop com ca content PDE stepper motor documentation 27964 pdf EE CME 392 Laboratory 4 7 Appendix UPC Bar Code Reader Information We have 5 scanner wands that use 5 volt supply and have analog output An interface circuit amplifies and digitizes this analog output for use by the microcontroller See images The UPC bars begin and end with thin black thin white thin black These narrow guard bars can be used to train the software Ifthe wand is moved at constant speed the pulse period of these initial bars serves as a reference to measure the width of the remaining bars Digitizer CCT Pin Analog Out Go butoSet Buffer 16 of 16 7 Source Channel Cond Falling Ei
9. qr Helpful resources http users ece utexas edu valvano arm index htm 4 http processors wiki ti com index php Stellaris LM4F120 LaunchPad Unbox EE CME 392 Laboratory 4 6 Appendix Stepper Motor Information A stepper motor is used when precision control of movement is needed the drive shaft rotates a precise number of degrees as current is applied to each coil in sequence You can often salvage steppers from old printers or disk drives The Department has seven RB Soy 03 stepper motors with center tapped windings that allow for Unipolar drive circuits see references for bipolar H Drive no center tap but 8 transistors are required The microcontroller does not have sufficient output current capability to drive each coil so use a transistor to drive each coil The diagram shows IRF2703 FET transistors 2 and since Vps lt 0 2 V for gate voltage greater than 3 volts there is little heat dissipation in the transistors A snubber diode sometimes called a freewheeling diode is required when a coil is turned off A large back emf is generated by the collapsing magnetic flux in the coil when the supply current is suddenly reduced This voltage could damage the transistor so the diode provides a path for the current to briefly continue The voltage is generated in the opposite direction from that needed to drive the coil hence the diode is wired in backwards A convenient alternate drive method uses the UNL2803 Darli
10. ropriate memory address must be taken from datasheet 2 for example GPIO PORTF DATA can be found on p 615 of the datasheet In order to use any GPIO several control registers need to be configured Some key registers are as follows GPIO PORTF DIR to set the input or output direction p 616 GPIO PORTF AFSEL to enable disable alternate functions p 625 GPIO PORTF DEN to enable digital functionality p 636 GPIO PORTF PCTL to enable clock on port p 641 and GPIO PORTF PUR to enable pull up resistors p 631 Bit Masking in Data Register Operation A special mechanism is used in Stellaris microcontrollers that allows programmer to individually modify the GPIO DATA registers with single instruction by using bits 9 2 of the address bus as a mask this is known as bit masking Refer to p 608 of the datasheet 2 for a detailed description For an example the base address of Port F is 0x4002 5000 If we want to read and write all 8 bits of this port the offset value we need to add to the base address is 0x03FC 1 e 0011 1111 1100 in binary This is why in the starter code GPIO PORTF DATA points to the memory location 0x4002 53FC instead of 0x4002 5000 As a result all read and write operations to GPIO PORTF DATA will access all 8 bits of Port F If we are interested in just bit 3 of Port F we will add an offset value of 0x0020 e 0000 0010 0000 in binary to the base address In that case GPIO PORTF DATA will point to memor
11. select one of the following tasks develop their own procedure for completion and verification 1 Dimmer Use the internal pulse width modulator PWM to control the light intensity of a LED i e simulating a dimmer action The dimmer control voltage should come from the potentiometer used in Part 1 The 7 segment display should be used in the same manner to display the control voltage The output pulse waveform and duty cycle are to be displayed on an oscilloscope Hints Connect the remaining potentiometer components of Fig 2 Extend the program written in part 1c to use the internal PWM See PWM information given in the Appendix Once the program is compiled and downloaded into the MPU vary the pot and observe the dimming action Take measurements to verify correct system operation and the accuracy of your design 2 Warning Lamp This task is to produce a visible warning system for tank pressure You are given a voltage developed by a pressure transducer for this lab use the potentiometer of Part Ic and you are to flash a lamp at 0 5 Hz for normal operation 1 Hz EE CME 392 Laboratory 4 5 for mild overpressure 2 Hz for danger and 4 Hz for extreme danger The duty cycle of the lamp should be 25 in each case The nominal pressure transducer voltages for each of these cases are 0 5 V 1 5 V 2 5 V and 3 5 V You should select appropriate voltage thresholds for your four cases Develop a procedure to verify the accuracy Remote
12. y location 0x4002 0020 The lab will use Keil uVision4 toolchain MDK lite version 4 6 which is already installed on the lab computers The user manual for the LaunchPad can be found in 1 also posted on EE392 website The user guide for uVision4 toolchain can be found on Keil s_ website http www keil com support man docs uv4 Revised Feb 28 2013 EE CME 392 Laboratory 4 2 Part la Starter project lt hour Obtain from the technicians one Stellaris LM4F120 LaunchPad and one four digit 7 segment display module Use the USB cable to connect the lab computer s USB port to the Power ICDI micro USB port at the top of the LaunchPad Make sure the slide switch in the top left corner is in the right hand position In order to verify the LaunchPad circuit function and to become familiar with loading a program into the LaunchPad you should run the starter project 1s provided on the course website Using the lab computers in 2C61 or 2C80 download the project starter zip unzip it and run the uVision4 project named start O uvproy Within uVision4 go to Projects gt Options for Target Under the utilities tab make sure that Stellaris ICDI is listed as the target driver for flash programming Close the window and Load download the code into the flash memory of the MCU To program the LaunchPad s MCU the Power Select Switch must remain in Debug position and the USB cable must remain connected sin

Download Pdf Manuals

image

Related Search

Related Contents

ECOFIRE MINNIE    MAX12 Manual (5.1 ES)  Magix Xtreme PhotoStory on CD & DVD 7  Guida introduttiva dei sistemi HD  Gebruiksaanwijzing Manual de Instrucciones  Safety Warnings and Precautions  fonctionnement - Enindel clima  Reiner SCT cyberJack RFID standard w/ WISO Paket  Toshiba LEDEUP00005S40 LED lamp  

Copyright © All rights reserved.
Failed to retrieve file