0% found this document useful (0 votes)
71 views9 pages

DDP Lab 2

The document describes the steps to create a Code Composer Studio project to blink an LED on a LaunchPad board. It details creating a new project, adding path variables, linking libraries, adding include paths, and building, loading and running the program to blink the LED.

Uploaded by

Eduardo Toribio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views9 pages

DDP Lab 2

The document describes the steps to create a Code Composer Studio project to blink an LED on a LaunchPad board. It details creating a new project, adding path variables, linking libraries, adding include paths, and building, loading and running the program to blink the LED.

Uploaded by

Eduardo Toribio
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

UNIVERSIDAD TECNOLÓGICA DE QUERÉTARO

CA INGENIERÍA EN TECNOLOGÍAS DE AUTOMATIZACIÓN


0 MANUAL PARA LA ELABORACIÓN DE PRÁCTICAS

Título de la práctica: Lab2 Int. Dev. Environment IDE


Nombre del alumno: Toribio Montoya Eduardo
Asignatura: Dispositivos Digitales Programables Hoja: 1 de 5
Unidad temática: I Entorno de programación de los dispositivos lógicos programables (PLD's) Fecha: 8 septiembre 2020
No. de participantes recomendados: Individual Elaboró: José Felipe Aguilar Pereyra
Duración: 2 h Lugar: Laboratorio virtual Revisó: Academia de Dispositivos Digitales Prog.
Aprobó: Coord. Acad. Ing. Tec. Automatización Revisión: 0 1 2 3 4
Fecha: 3 sept 2020

Goals for the practice:

“The objective of this lab is to create a project that contains two source files, main.c and tm4c123gh6pm_startup_ccs.c, which
contain the code to blink an LED on your LaunchPad board. The purpose of this lab is to practice creating projects and getting to
know the look and feel of Code Composer Studio. (Texas Instruments, 2013)

Theoretical Foundation:
Procedure to Create a New CCS Project:

► select Project → New CCS Project:


► For the project name, type lab2
► Uncheck the box “Use default location” and click the Browse. button. Navigate to:
C:\TM4C123G_LaunchPad_Workshop\lab2\project and click OK.
► Select Device family: ARM, for Variant, type 123G in the filter text field, then select Tiva TM4C123GH6PM in
the drop-down box (typing 123G narrows the list making it easier to find the exact part on the Tiva LaunchPad board.
► For Connection: choose Stellaris In-Circuit Debug Interface. This is the built- in emulator on the LaunchPad board.
► In the Project templates and examples box, choose Empty Project and then click Finish

Procedure for Adding a Path Variable:

► Right-click on your project and select Properties.


► Expand the Resource list in the upper left-hand corner as shown and click on Linked Resources: You will see two
tabs on the right side – Path Variables and Linked Resources: In the Path Variables tab, notice that PROJECT_LOC is
listed and will display as the default path variable for linked resources in your project. We want to add a New variable
to specify exactly where you installed TivaWare.
► Click New
► When the New Variable dialog appears, type TIVAWARE_INSTALL for the name.
► For the Location, click the Folder... button and navigate to your TivaWare installation. Click on the folder name
and then click OK.
► Click OK. You should see your new path variable listed in the Path Variables list

Procedure for Adding a Build Variable:

► Click on Build and then the Variables tab:


► Click the Add button. When the Define a New Build Variable dialog appears, insert TIVAWARE_INSTALL into
the Variables name box.
► Check the “Apply to all configurations” checkbox
Título de la práctica: Lab2 Int. Dev. Environment IDE
Nombre del alumno: Toribio Montoya Eduardo
Asignatura: Dispositivos Digitales Programables Hoja: 1 de 5
Unidad temática: I Entorno de programación de los dispositivos lógicos programables (PLD's) Fecha: 8 septiembre 2020
► Change the Type to Directory and browse to your Tivaware installation folder. ► Click OK. ► Click OK again to
save and close the Build Properties window.

Procedure to Link the TivaWare driverlib.lib file to your project:

► Select Project-Add Files... Navigate to: C:\TI\TivaWare_C_Series 1.1\driverlib\ccs\Debug\driverlib.lib


► click Open. The File Operation dialog will open Use the TIVAWARE_INSTALL path variable you created earlier.
This means that the LINK (or reference to the library) file will be RELATIVE to the location of the TivaWare
installation. If you hand this project to someone else, they can install the project anywhere in the file system and this
link will still work. If you choose PROJECT_LOC, you would get a path that is relative to the location of your project
and it would require the project to be installed at the same “level” in the directory structure. Another advantage of this
approach is that if you wanted to link to a new version, say TivaWare_C_Series1.2, all you have to do is modify the
variable to the new folder name.
► Make the selections shown and click OK. Your project should now look something like the screen capture below.
Note the symbol for driverlib.lib denotes a linked file.

Procedure to Add the INCLUDE search paths for the header files:

► Open main.c by double-clicking on the filename in the Project Explorer pane of CCS. You should see “?” warnings
in the left margin which indicate “unresolved inclusion”. Hover your cursor over the question mark to see the helpful
message. Until now, you haven’t told the project where to find these header files.
► Right-click on your lab2 project in the Project Explorer pane and select Properties.
► Click on Build → ARM Compiler → Include Options (as shown):
► In the lower-right panel, click the “+” sign next to Add dir to #include search path and add the following path using
the build variable you created earlier. Place the variable name inside braces, after the $ as shown:
${TIVAWARE_INSTALL}
► Click OK.
► Click OK again, and now you should see those “?” in main.c disappear after a moment. Problem solved

Procedure to Build:
Procedure to Load:
Procedure to Run (Debug):

► Assure that your LaunchPad is connected to your laptop. Build and load your project to the TM4C123GH6PM
flash memory by clicking the Debug button . If you ever want to build the project without loading it, click the
HAMMER (Build) button.
► Click the Resume button or press the F8 key on your keyboard: The tri-color LED on your target board should
blink showing the three colors in sequence. If not, attempt to solve the problem yourself for a few minutes, and then
ask your instructor for help. To stop your program running,
► click the Suspend button: If the code stops with a “No source available” indication, click on the main.c tab. Most of
the time in the while() loop is spent inside the delay function. That source file is not linked into this project.
Título de la práctica: Lab2 Int. Dev. Environment IDE
Nombre del alumno: Toribio Montoya Eduardo
Asignatura: Dispositivos Digitales Programables Hoja: 1 de 5
Unidad temática: I Entorno de programación de los dispositivos lógicos programables (PLD's) Fecha: 8 septiembre 2020
Problem Statement

1. Lectura del Workbook sección Code Composer Studio


2. Creación de un nuevo proyecto CCS
3. Agregar una variable de ruta de librerías
4. Vincular el archivo driverlib.lib al proyecto
5. Incluir la ruta de las librerías para los archivos de cabecera
6. Construir, cargar y ejecutar el programa.

Materials

Tiva C Series TM4C123G Evaluation Kit


PC con Code Composer Studio y Tivaware

Customer requirements:
N/A
Blocks diagram:

Terminal Assignment

Terminal Nombre Función Tipo


29 PF1 LED_R GPIO/0
30 PF2 LED_B GPIO/0
31 PF3 LED_G GPIO/0
28 PF0 USR_SW2 GPIO/I
5 PF4 USR_SW1 GPIO/I
Electronic diagram
Annexed 1
Diagrama de flujo
Start

Start system clock 40MHz

Peripheral configuration

While (1) End

Display in port F the value of the variable Ui8PinData

Time delay 1.5 seg

Exhibir en puerto F el valor de 0x00

Time delay 1.5 seg

Ui8PinData
Ui8PinData= Ui8PinData*2
==8?

Ui8PinData==2?
Código desarrollado
#include <stdint.h> //incluye Definiciones de variables para estandar c99
#include <stdbool.h> //incluye Definiciones de boleanos para estandar c99
#include "inc/hw_memmap.h" //incluye Definiciones macros del mapa de memoria del dispositivo Tiva C
#include "inc/hw_types.h" //incluye Definiciones de tipos comunes de harware
#include "driverlib/sysctl.h" //incluye Definiciones y macros del sistema de control
#include "driverlib/gpio.h" //incluye Definiciones y macros para GPIO

uint8_t ui8PinData=2; //Crear la variable ui8PinData e inicializar con el valor de dos


/**
* main.c
*/
int main(void) //inicia la funcion principal
{
// establecer el reloj del control del sistema a 40MHz
SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);

//Configuracion de perifericos
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); //Habilita periferico puerto F
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3);//Configurar de tipo GPIO salida las
terminales PF1, PF2, PF3

while(1) // Ciclo while


{
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, ui8PinData);
SysCtlDelay(2000000);
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 0x00);
SysCtlDelay(2000000);
if(ui8PinData==8) {ui8PinData=2;} else {ui8PinData=ui8PinData*2;}
}

return 0;
} //fin función principal

Pruebas

Connect tiva series c board with cable to pc.


Press build button.
Press debug button
Press run

Resultados
The build button was pressed.

Debug button is pressed

Run is pressed
led sequence
Bibliografía
Texas Instruments. (2013). Getting Started with the Tiva™ TM4C123G LaunchPad Workshop Student Guide and Lab
Manual. Texas: Texas Instruments.
Annexed 1 Electronic diagram

You might also like