SlideShare una empresa de Scribd logo
1 de 5
Lab 1
EENG 3910: Project V - Digital Signal
Processing System Design
9/14/2015
Joseph Chandler
University of North Texas
College of Engineering
Electrical Engineering
Introduction
Lab 1 introducesthe TivaTM
C SeriesEK-TM4C123GXL. Code ComposerStudio(CCS) isusedforsoftware
supportand boththe hardware and software are productsof TexasInstruments.
Results and Discussion
Problem 1
The firstproblemisan introductiontoCCS.It explainshow toconfigure the TivaTM
CSeriesEK-
TM4C123GH6XL. Afterthe hardware parametersare set,a sample programisaddedto the new project
for analysis.The buildfunctionisshownandthe debuginterface isshown.
Problem 2
#include <stdint.h>
Thisline containsthe headerfile for variabledefinitions.The headerfileisalreadydefinedinthe CCS
software.Examplesof the valuesare bitsize,precision,andsignedorunsignedintegers.
#include <stdbool.h>
Thisline containsthe headerfile forBooleandefinitions.The headerfile isalreadydefinedinthe CCS
software.The file definitionsare usedforoperations,comparingvariables,andprogramcontrol flow.
#include "inc/hw_memmap.h"
Thisline containsthe headerfile forthe TivaCSeriesdevice memorymapdefinitions.The headerfile
containsmanyof the same definitionsusedfordirectregisteraccess.The headerfilecontainsmacros
and definitionstosimplifyprogrammingthe peripheral'sregistersandinterruptcontrol.The definitions
are usedbydriverlibrariesandare hiddenfromthe programmer.
#include "inc/hw_types.h"
Thisline containsthe headerfile forcommontypesandmacros.The headerfile containsmanyof the
same definitionsusedfordirectregisteraccess.The valuesare awide varietyof general use for items
such as arithmetic,clocktiming,file recognition,anddevicerecognition.
#include "driverlib/sysctl.h"
Thisline containsthe headerfile forthe SystemControl APIdefinitionsandmacros.The headerfile isin
the directory"driverlib"of the CCS software.The driversprovideguidedcontrol of the peripheralsand
allowsforquickapplication.Enablingperipheralsisanexampleof thiscontrol.
#include "driverlib/gpio.h"
Thisline containsthe headerfile forGPIOAPIdefinitionsandmacros.The headerfile isinthe directory
"driverlib"of the CCSsoftware.The driverprovidesasetof functionstocontrol the inputand output
module.
int main(void){
The main processcalls andacts on variables,macros,definitions,andothersystemfunctions.
uint8_t pin_data=2;
An unsigned 8-bitintegervariable isinitializedto2
uint32_t delay_count=2.66e7;
An unsigned 32-bitvariable isinitialized to2.66e7
SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
SystemControl ClockSet setsthe clockingof the device. Osc_Mainconfiguresthe oscillatorsource.
XTAL_16MHZ usesa 16 MHZ crystal clock. USE_PLL is a phase lockedloopat 400 MHz. SYSDIV_5divides
the clock bythe numberspecifiedgivingcontrol of the frequency
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
Enablesthe peripheral forthe general purpose input/outputportF
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);
Thisline configurespinsforuse asGPIOoutputs.The firstparameteristhe base addressof the GPIO
port. Inthisapplicationthatwouldbe portF. The nextparameteristhe bit-packedrepresentationof the
pins. Thisfunctionprovidesproperconfigurationof the pinswithoutprogramming registers.Type of
outputwill be the three onboardLEDs that use portF.
while(1) {
The while loopprovidesa continuousloop whensetto"1".
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, pin_data);
Thisline writesavalue tothe specifiedpins. The valueiscontainedinthe variable"pin_data".The initial
state of "pin-data"is2. Therefore,the value2is giventoall of the pins.Yet,onlyone of the pinswill
correspondtothe givenvalue due toa pre-setconditionof 2mA,4mA,and 8mA.
SysCtlDelay(delay_count);
Thisline providesadelay.The variable "delay_count"holdsthe value of the delayloop. The constantis
2.66e7. The loopiterates3 times.
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 0);
Thisline writes avalue tothe specifiedpins. Therefore,the value0is giventoall of the pins. This
essentiallyclearsthe LEDsof all "high"input.NoLED action.
SysCtlDelay(delay_count);
Thisline providesadelay.The variable "delay_count"holdsthe value of the delayloop.The constantis
2.66e7. The loopiterates3 times.
if(pin_data == 8)
The "if"statementischeckingif the current value of the pinvariable isequal to8.
pin_data = 2;
The value of the pinvariable issetto2.
else
The "else"statementisusedwhenthe currentvalue of the pinvariable isnotequal to8.
pin_data = pin_data*2;
The value of the pinvariable ismultipliedby2.
Problem 3
The EK-TM4C123GXL LED clock rates are increasedwhenthe numberof systemdivisionsare decreased.
SysCtlClockSet(SYSCTL_SYSDIV_10|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
20 MHz
SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
40 MHz
SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
50 MHz
SysCtlClockSet(SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
80 MHz
Next,the valuesof the variable "delay_count"weredeterminedfor1secondaccordingto the rise in
frequency. The desiredfrequencywasdividedby3 cpu cyclesto determinethe time delayinterval
neededinthe systemvariable"delay_count".
uint32_t delay_count=0.66e7; // For about 1s delay at 20 MHz clock rate.
20MHZ/3 = 0.67e7
uint32_t delay_count=1.33e7; // For about 1s delay at 40 MHz clock rate.
40MHZ/3 = 1.33e7
uint32_t delay_count=1.66e7; // For about 1s delay at 50 MHz clock rate.
50MHZ/3 = 1.67e7
uint32_t delay_count=2.66e7; // For about 1s delay at 80 MHz clock rate.
80MHZ/3 = 2.67e7
Finally,the variable"delay_count"waschangedtothe resultsabove.The resultof the LED displayis 1
seconddelay.
Problem 4
An Introductiontothe TivaC SeriesPlatformof Microcontrollerswasanoverview of TI'snextgeneration
of ARM Cortex M4 processors.The reportonthe new microprocessorsboastedof the new 32-bit
architecture andhighprecision.The serieshasalarge instructionset andbetterresolutionforcapturing
samplesof analogsignalsandconvertingthemtodigital.Multi-taskingandreal-time applicationhas
greatlyimproved.Also,the durabilityhasimprovedalongwithlow energyconsumption.
TivaWare Peripheral DriverLibraryisa setof driversthatmake the TIVA C Serieseasiertoprogram.They
are writteninCfor the most part and efficient.There are multiplesoftwarepackagesthatare available
to use all the driversare mappedout fordirectregisteraccess.The driverlibrarycanbe usedalongwith
directregisteraccessformore efficientprogramming.The generalpurpose input/outputmodule has8
pinsthat can be configuredasan inputor an outputwithdifferentcapabilities.Also,more thanone pin
can be operatedonat one time.The systemcontrol givesmore flexibilitywithabilitiestochange
frequency,timing,clock-type,energyuse,andthree differentoperatingmodes.
The TM4C123GH6PM MicrocontrollerOverview givesdetailedinformationaboutthe Core,
Performance,Flash,SystemSRAM,EEPROM,Internal ROM,Security,CommunicationInterfaces,System
Integration,AdvancedMotionControl,AnalogSupport,andhardware layout.
The three LEDs are connectedthroughportF of the GPIO module.The schematicshowsthe three LEDs
have diodescontrollingthe input.The diodesturnonfor the gatesthat correspondto2, 4, and 8. This
referstothe mA that activateseachLED. If itdoesnot containthe right amountof mA the transistoris
not activated. Eachiterationof the loopsends a "0" or "off" to all the gatesbefore the new loop
iterationiscalculated.
Summary and Conclusion
The Tiva C SeriesTM4C123G MicrocontrollerwasattachedbyUSB to the CPU and there were notany
problemswithpowering onorcompatibilitywithWindows7.CCS wasveryuserfriendlyandoffered
differenthardware implementation.The programswere builtwithouterrorandran accordingto plan.
CCS programsusedsoftware driverstomapmostof the hardware and applications.
References
TexasInstruments.(2014).TivaWarePeripheral Driver Library: User'sGuide. Austin,Texas:TI.

Más contenido relacionado

La actualidad más candente

Matlab source codes section | Download MATLAB source code freerce-codes
Matlab source codes section | Download MATLAB source code freerce-codesMatlab source codes section | Download MATLAB source code freerce-codes
Matlab source codes section | Download MATLAB source code freerce-codeshafsabanu
 
5.MLP(Multi-Layer Perceptron)
5.MLP(Multi-Layer Perceptron) 5.MLP(Multi-Layer Perceptron)
5.MLP(Multi-Layer Perceptron) 艾鍗科技
 
Pragmatic Optimization in Modern Programming - Ordering Optimization Approaches
Pragmatic Optimization in Modern Programming - Ordering Optimization ApproachesPragmatic Optimization in Modern Programming - Ordering Optimization Approaches
Pragmatic Optimization in Modern Programming - Ordering Optimization ApproachesMarina Kolpakova
 
A study to Design and comparison of Full Adder using Various Techniques
A study to Design and comparison of Full Adder using Various TechniquesA study to Design and comparison of Full Adder using Various Techniques
A study to Design and comparison of Full Adder using Various TechniquesIOSR Journals
 
Pragmatic optimization in modern programming - modern computer architecture c...
Pragmatic optimization in modern programming - modern computer architecture c...Pragmatic optimization in modern programming - modern computer architecture c...
Pragmatic optimization in modern programming - modern computer architecture c...Marina Kolpakova
 
Lec15 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- EPIC VLIW
Lec15 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- EPIC VLIWLec15 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- EPIC VLIW
Lec15 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- EPIC VLIWHsien-Hsin Sean Lee, Ph.D.
 
17443 microprocessor
17443   microprocessor17443   microprocessor
17443 microprocessorsoni_nits
 
Embedded system (Chapter )
Embedded system (Chapter )Embedded system (Chapter )
Embedded system (Chapter )Ikhwan_Fakrudin
 
Ebc7fc8ba9801f03982acec158fa751744ca copie
Ebc7fc8ba9801f03982acec158fa751744ca   copieEbc7fc8ba9801f03982acec158fa751744ca   copie
Ebc7fc8ba9801f03982acec158fa751744ca copieSourour Kanzari
 
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the CompilerPragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the CompilerMarina Kolpakova
 
Pragmatic Optimization in Modern Programming - Mastering Compiler Optimizations
Pragmatic Optimization in Modern Programming - Mastering Compiler OptimizationsPragmatic Optimization in Modern Programming - Mastering Compiler Optimizations
Pragmatic Optimization in Modern Programming - Mastering Compiler OptimizationsMarina Kolpakova
 
8086 MICROPROCESSOR
8086 MICROPROCESSOR8086 MICROPROCESSOR
8086 MICROPROCESSORAlxus Shuvo
 
LinuxCNC 入門簡介
LinuxCNC 入門簡介LinuxCNC 入門簡介
LinuxCNC 入門簡介roboard
 
Melp codec optimization using DSP kit
Melp codec optimization using DSP kitMelp codec optimization using DSP kit
Melp codec optimization using DSP kitsohaibaslam207
 

La actualidad más candente (20)

Matlab source codes section | Download MATLAB source code freerce-codes
Matlab source codes section | Download MATLAB source code freerce-codesMatlab source codes section | Download MATLAB source code freerce-codes
Matlab source codes section | Download MATLAB source code freerce-codes
 
5.MLP(Multi-Layer Perceptron)
5.MLP(Multi-Layer Perceptron) 5.MLP(Multi-Layer Perceptron)
5.MLP(Multi-Layer Perceptron)
 
Lecture5(1)
Lecture5(1)Lecture5(1)
Lecture5(1)
 
Pragmatic Optimization in Modern Programming - Ordering Optimization Approaches
Pragmatic Optimization in Modern Programming - Ordering Optimization ApproachesPragmatic Optimization in Modern Programming - Ordering Optimization Approaches
Pragmatic Optimization in Modern Programming - Ordering Optimization Approaches
 
A study to Design and comparison of Full Adder using Various Techniques
A study to Design and comparison of Full Adder using Various TechniquesA study to Design and comparison of Full Adder using Various Techniques
A study to Design and comparison of Full Adder using Various Techniques
 
Pragmatic optimization in modern programming - modern computer architecture c...
Pragmatic optimization in modern programming - modern computer architecture c...Pragmatic optimization in modern programming - modern computer architecture c...
Pragmatic optimization in modern programming - modern computer architecture c...
 
Dr.s.shiyamala fpga ppt
Dr.s.shiyamala  fpga pptDr.s.shiyamala  fpga ppt
Dr.s.shiyamala fpga ppt
 
Lec15 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- EPIC VLIW
Lec15 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- EPIC VLIWLec15 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- EPIC VLIW
Lec15 Computer Architecture by Hsien-Hsin Sean Lee Georgia Tech -- EPIC VLIW
 
17443 microprocessor
17443   microprocessor17443   microprocessor
17443 microprocessor
 
Embedded system (Chapter )
Embedded system (Chapter )Embedded system (Chapter )
Embedded system (Chapter )
 
100 103
100 103100 103
100 103
 
Ebc7fc8ba9801f03982acec158fa751744ca copie
Ebc7fc8ba9801f03982acec158fa751744ca   copieEbc7fc8ba9801f03982acec158fa751744ca   copie
Ebc7fc8ba9801f03982acec158fa751744ca copie
 
Code GPU with CUDA - SIMT
Code GPU with CUDA - SIMTCode GPU with CUDA - SIMT
Code GPU with CUDA - SIMT
 
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the CompilerPragmatic Optimization in Modern Programming - Demystifying the Compiler
Pragmatic Optimization in Modern Programming - Demystifying the Compiler
 
Pragmatic Optimization in Modern Programming - Mastering Compiler Optimizations
Pragmatic Optimization in Modern Programming - Mastering Compiler OptimizationsPragmatic Optimization in Modern Programming - Mastering Compiler Optimizations
Pragmatic Optimization in Modern Programming - Mastering Compiler Optimizations
 
FPGA Implementation of High Speed FIR Filters and less power consumption stru...
FPGA Implementation of High Speed FIR Filters and less power consumption stru...FPGA Implementation of High Speed FIR Filters and less power consumption stru...
FPGA Implementation of High Speed FIR Filters and less power consumption stru...
 
Quiz 9
Quiz 9Quiz 9
Quiz 9
 
8086 MICROPROCESSOR
8086 MICROPROCESSOR8086 MICROPROCESSOR
8086 MICROPROCESSOR
 
LinuxCNC 入門簡介
LinuxCNC 入門簡介LinuxCNC 入門簡介
LinuxCNC 入門簡介
 
Melp codec optimization using DSP kit
Melp codec optimization using DSP kitMelp codec optimization using DSP kit
Melp codec optimization using DSP kit
 

Similar a DSP_Assign_1

Bascom avr-course
Bascom avr-courseBascom avr-course
Bascom avr-coursehandson28
 
20081114 Friday Food iLabt Bart Joris
20081114 Friday Food iLabt Bart Joris20081114 Friday Food iLabt Bart Joris
20081114 Friday Food iLabt Bart Jorisimec.archive
 
Applications - embedded systems
Applications - embedded systemsApplications - embedded systems
Applications - embedded systemsDr.YNM
 
DSP_Assign_2 (Autosaved)
DSP_Assign_2 (Autosaved)DSP_Assign_2 (Autosaved)
DSP_Assign_2 (Autosaved)Joseph Chandler
 
Crypto Performance on ARM Cortex-M Processors
Crypto Performance on ARM Cortex-M ProcessorsCrypto Performance on ARM Cortex-M Processors
Crypto Performance on ARM Cortex-M ProcessorsHannes Tschofenig
 
Lorenzo 1210 features
Lorenzo 1210   featuresLorenzo 1210   features
Lorenzo 1210 featuresMark Chien
 
Embedded processor system for controllable period-width multichannel pulse wi...
Embedded processor system for controllable period-width multichannel pulse wi...Embedded processor system for controllable period-width multichannel pulse wi...
Embedded processor system for controllable period-width multichannel pulse wi...TELKOMNIKA JOURNAL
 
My seminar new 28
My seminar new 28My seminar new 28
My seminar new 28rajeshkvdn
 
Bhabha atomic research Centre (BARC)
Bhabha atomic research Centre (BARC)Bhabha atomic research Centre (BARC)
Bhabha atomic research Centre (BARC)Utkarsh Tiwari
 
An Overview of LPC2101/02/03
An Overview of LPC2101/02/03An Overview of LPC2101/02/03
An Overview of LPC2101/02/03Premier Farnell
 
ESPM2 2018 - Automatic Generation of High-Order Finite-Difference Code with T...
ESPM2 2018 - Automatic Generation of High-Order Finite-Difference Code with T...ESPM2 2018 - Automatic Generation of High-Order Finite-Difference Code with T...
ESPM2 2018 - Automatic Generation of High-Order Finite-Difference Code with T...Hideyuki Tanaka
 
IRJET-Error Detection and Correction using Turbo Codes
IRJET-Error Detection and Correction using Turbo CodesIRJET-Error Detection and Correction using Turbo Codes
IRJET-Error Detection and Correction using Turbo CodesIRJET Journal
 
Fpga implementation of multi protocol data
Fpga implementation of multi protocol dataFpga implementation of multi protocol data
Fpga implementation of multi protocol dataeSAT Publishing House
 

Similar a DSP_Assign_1 (20)

Bascom avr-course
Bascom avr-courseBascom avr-course
Bascom avr-course
 
20081114 Friday Food iLabt Bart Joris
20081114 Friday Food iLabt Bart Joris20081114 Friday Food iLabt Bart Joris
20081114 Friday Food iLabt Bart Joris
 
Design and Implementation of Pulse Width Modulation Using Hardware/Software M...
Design and Implementation of Pulse Width Modulation Using Hardware/Software M...Design and Implementation of Pulse Width Modulation Using Hardware/Software M...
Design and Implementation of Pulse Width Modulation Using Hardware/Software M...
 
DSP_Assign_3
DSP_Assign_3DSP_Assign_3
DSP_Assign_3
 
Applications - embedded systems
Applications - embedded systemsApplications - embedded systems
Applications - embedded systems
 
DSP_Assign_2 (Autosaved)
DSP_Assign_2 (Autosaved)DSP_Assign_2 (Autosaved)
DSP_Assign_2 (Autosaved)
 
Crypto Performance on ARM Cortex-M Processors
Crypto Performance on ARM Cortex-M ProcessorsCrypto Performance on ARM Cortex-M Processors
Crypto Performance on ARM Cortex-M Processors
 
Lorenzo 1210 features
Lorenzo 1210   featuresLorenzo 1210   features
Lorenzo 1210 features
 
Embedded processor system for controllable period-width multichannel pulse wi...
Embedded processor system for controllable period-width multichannel pulse wi...Embedded processor system for controllable period-width multichannel pulse wi...
Embedded processor system for controllable period-width multichannel pulse wi...
 
Dsp lab manual 15 11-2016
Dsp lab manual 15 11-2016Dsp lab manual 15 11-2016
Dsp lab manual 15 11-2016
 
My seminar new 28
My seminar new 28My seminar new 28
My seminar new 28
 
Picmico
PicmicoPicmico
Picmico
 
Bhabha atomic research Centre (BARC)
Bhabha atomic research Centre (BARC)Bhabha atomic research Centre (BARC)
Bhabha atomic research Centre (BARC)
 
[IJET-V1I3P17] Authors :Prof. U. R. More. S. R. Adhav
[IJET-V1I3P17] Authors :Prof. U. R. More. S. R. Adhav[IJET-V1I3P17] Authors :Prof. U. R. More. S. R. Adhav
[IJET-V1I3P17] Authors :Prof. U. R. More. S. R. Adhav
 
An Overview of LPC2101/02/03
An Overview of LPC2101/02/03An Overview of LPC2101/02/03
An Overview of LPC2101/02/03
 
Assignment
AssignmentAssignment
Assignment
 
ESPM2 2018 - Automatic Generation of High-Order Finite-Difference Code with T...
ESPM2 2018 - Automatic Generation of High-Order Finite-Difference Code with T...ESPM2 2018 - Automatic Generation of High-Order Finite-Difference Code with T...
ESPM2 2018 - Automatic Generation of High-Order Finite-Difference Code with T...
 
IRJET-Error Detection and Correction using Turbo Codes
IRJET-Error Detection and Correction using Turbo CodesIRJET-Error Detection and Correction using Turbo Codes
IRJET-Error Detection and Correction using Turbo Codes
 
Fpga implementation of multi protocol data
Fpga implementation of multi protocol dataFpga implementation of multi protocol data
Fpga implementation of multi protocol data
 
40120140504013
4012014050401340120140504013
40120140504013
 

DSP_Assign_1

  • 1. Lab 1 EENG 3910: Project V - Digital Signal Processing System Design 9/14/2015 Joseph Chandler University of North Texas College of Engineering Electrical Engineering
  • 2. Introduction Lab 1 introducesthe TivaTM C SeriesEK-TM4C123GXL. Code ComposerStudio(CCS) isusedforsoftware supportand boththe hardware and software are productsof TexasInstruments. Results and Discussion Problem 1 The firstproblemisan introductiontoCCS.It explainshow toconfigure the TivaTM CSeriesEK- TM4C123GH6XL. Afterthe hardware parametersare set,a sample programisaddedto the new project for analysis.The buildfunctionisshownandthe debuginterface isshown. Problem 2 #include <stdint.h> Thisline containsthe headerfile for variabledefinitions.The headerfileisalreadydefinedinthe CCS software.Examplesof the valuesare bitsize,precision,andsignedorunsignedintegers. #include <stdbool.h> Thisline containsthe headerfile forBooleandefinitions.The headerfile isalreadydefinedinthe CCS software.The file definitionsare usedforoperations,comparingvariables,andprogramcontrol flow. #include "inc/hw_memmap.h" Thisline containsthe headerfile forthe TivaCSeriesdevice memorymapdefinitions.The headerfile containsmanyof the same definitionsusedfordirectregisteraccess.The headerfilecontainsmacros and definitionstosimplifyprogrammingthe peripheral'sregistersandinterruptcontrol.The definitions are usedbydriverlibrariesandare hiddenfromthe programmer. #include "inc/hw_types.h" Thisline containsthe headerfile forcommontypesandmacros.The headerfile containsmanyof the same definitionsusedfordirectregisteraccess.The valuesare awide varietyof general use for items such as arithmetic,clocktiming,file recognition,anddevicerecognition. #include "driverlib/sysctl.h" Thisline containsthe headerfile forthe SystemControl APIdefinitionsandmacros.The headerfile isin the directory"driverlib"of the CCS software.The driversprovideguidedcontrol of the peripheralsand allowsforquickapplication.Enablingperipheralsisanexampleof thiscontrol. #include "driverlib/gpio.h"
  • 3. Thisline containsthe headerfile forGPIOAPIdefinitionsandmacros.The headerfile isinthe directory "driverlib"of the CCSsoftware.The driverprovidesasetof functionstocontrol the inputand output module. int main(void){ The main processcalls andacts on variables,macros,definitions,andothersystemfunctions. uint8_t pin_data=2; An unsigned 8-bitintegervariable isinitializedto2 uint32_t delay_count=2.66e7; An unsigned 32-bitvariable isinitialized to2.66e7 SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); SystemControl ClockSet setsthe clockingof the device. Osc_Mainconfiguresthe oscillatorsource. XTAL_16MHZ usesa 16 MHZ crystal clock. USE_PLL is a phase lockedloopat 400 MHz. SYSDIV_5divides the clock bythe numberspecifiedgivingcontrol of the frequency SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); Enablesthe peripheral forthe general purpose input/outputportF GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3); Thisline configurespinsforuse asGPIOoutputs.The firstparameteristhe base addressof the GPIO port. Inthisapplicationthatwouldbe portF. The nextparameteristhe bit-packedrepresentationof the pins. Thisfunctionprovidesproperconfigurationof the pinswithoutprogramming registers.Type of outputwill be the three onboardLEDs that use portF. while(1) { The while loopprovidesa continuousloop whensetto"1". GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, pin_data); Thisline writesavalue tothe specifiedpins. The valueiscontainedinthe variable"pin_data".The initial state of "pin-data"is2. Therefore,the value2is giventoall of the pins.Yet,onlyone of the pinswill correspondtothe givenvalue due toa pre-setconditionof 2mA,4mA,and 8mA. SysCtlDelay(delay_count); Thisline providesadelay.The variable "delay_count"holdsthe value of the delayloop. The constantis 2.66e7. The loopiterates3 times. GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 0);
  • 4. Thisline writes avalue tothe specifiedpins. Therefore,the value0is giventoall of the pins. This essentiallyclearsthe LEDsof all "high"input.NoLED action. SysCtlDelay(delay_count); Thisline providesadelay.The variable "delay_count"holdsthe value of the delayloop.The constantis 2.66e7. The loopiterates3 times. if(pin_data == 8) The "if"statementischeckingif the current value of the pinvariable isequal to8. pin_data = 2; The value of the pinvariable issetto2. else The "else"statementisusedwhenthe currentvalue of the pinvariable isnotequal to8. pin_data = pin_data*2; The value of the pinvariable ismultipliedby2. Problem 3 The EK-TM4C123GXL LED clock rates are increasedwhenthe numberof systemdivisionsare decreased. SysCtlClockSet(SYSCTL_SYSDIV_10|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); 20 MHz SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); 40 MHz SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); 50 MHz SysCtlClockSet(SYSCTL_SYSDIV_2_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN); 80 MHz Next,the valuesof the variable "delay_count"weredeterminedfor1secondaccordingto the rise in frequency. The desiredfrequencywasdividedby3 cpu cyclesto determinethe time delayinterval neededinthe systemvariable"delay_count". uint32_t delay_count=0.66e7; // For about 1s delay at 20 MHz clock rate. 20MHZ/3 = 0.67e7 uint32_t delay_count=1.33e7; // For about 1s delay at 40 MHz clock rate. 40MHZ/3 = 1.33e7
  • 5. uint32_t delay_count=1.66e7; // For about 1s delay at 50 MHz clock rate. 50MHZ/3 = 1.67e7 uint32_t delay_count=2.66e7; // For about 1s delay at 80 MHz clock rate. 80MHZ/3 = 2.67e7 Finally,the variable"delay_count"waschangedtothe resultsabove.The resultof the LED displayis 1 seconddelay. Problem 4 An Introductiontothe TivaC SeriesPlatformof Microcontrollerswasanoverview of TI'snextgeneration of ARM Cortex M4 processors.The reportonthe new microprocessorsboastedof the new 32-bit architecture andhighprecision.The serieshasalarge instructionset andbetterresolutionforcapturing samplesof analogsignalsandconvertingthemtodigital.Multi-taskingandreal-time applicationhas greatlyimproved.Also,the durabilityhasimprovedalongwithlow energyconsumption. TivaWare Peripheral DriverLibraryisa setof driversthatmake the TIVA C Serieseasiertoprogram.They are writteninCfor the most part and efficient.There are multiplesoftwarepackagesthatare available to use all the driversare mappedout fordirectregisteraccess.The driverlibrarycanbe usedalongwith directregisteraccessformore efficientprogramming.The generalpurpose input/outputmodule has8 pinsthat can be configuredasan inputor an outputwithdifferentcapabilities.Also,more thanone pin can be operatedonat one time.The systemcontrol givesmore flexibilitywithabilitiestochange frequency,timing,clock-type,energyuse,andthree differentoperatingmodes. The TM4C123GH6PM MicrocontrollerOverview givesdetailedinformationaboutthe Core, Performance,Flash,SystemSRAM,EEPROM,Internal ROM,Security,CommunicationInterfaces,System Integration,AdvancedMotionControl,AnalogSupport,andhardware layout. The three LEDs are connectedthroughportF of the GPIO module.The schematicshowsthe three LEDs have diodescontrollingthe input.The diodesturnonfor the gatesthat correspondto2, 4, and 8. This referstothe mA that activateseachLED. If itdoesnot containthe right amountof mA the transistoris not activated. Eachiterationof the loopsends a "0" or "off" to all the gatesbefore the new loop iterationiscalculated. Summary and Conclusion The Tiva C SeriesTM4C123G MicrocontrollerwasattachedbyUSB to the CPU and there were notany problemswithpowering onorcompatibilitywithWindows7.CCS wasveryuserfriendlyandoffered differenthardware implementation.The programswere builtwithouterrorandran accordingto plan. CCS programsusedsoftware driverstomapmostof the hardware and applications. References TexasInstruments.(2014).TivaWarePeripheral Driver Library: User'sGuide. Austin,Texas:TI.