Question: (Ccs Using Tiva C) Procedure From Resource Explorer search for information about our board EK-TM4C123GXL. Using the resulting tree (inside the Explorer panel), find the

(Ccs Using Tiva C)

Procedure

  1. From Resource Explorer search for information about our board EK-TM4C123GXL.
  2. Using the resulting tree (inside the Explorer panel), find the example 'blinky", (Software>TM4C ARM Cortex-M4F>Examples>blinky) and click on "blinky".
  3. Using the icons in the upper right corner, use the "Import to IDE" get a local copy of the project. Then use the "Install" icon to create a project that you can edit.
  4. Rename "blinky" to "lab2". (Click on "blinky" and then "File>Rename".)
  5. Strip out all the blinky code and update the include directives to have these header files: #include #include #include "inc/hw_types.h" #include "inc/hw_memmap.h" #include "inc/hw_nvic.h" #include "driverlib/gpio.h" #include "driverlib/sysctl.h" #include "driverlib/systick.h" #include "buttons.h"
  6. Copy the buttons.h and buttons.c into your project directory; for example: cp -i ~/ti/.../examples/boards/ek-tm4c123gxl/drivers/buttons.[ch] .

  7. Now you are ready to begin: Review the requirements below and plan out the software needed for this project. No extra hardware circuit is needed for this lab.

    • HINT1: Create two functions: "main()" and "mydelay()".

    • HINT2: how will you alternate the two colors?

    • HINT3: Where do you check for debounce in the design? set the clock frequency to 80 MHz

      • enable the port for the red and green LEDs

      • (wait for it to be ready)

      • set the GPIO direction

  8. In the second part of main(),
    • set up the switchs (using calls to button.c)
    • set SysTick RELOAD value for a 0.2 s delay
    • enable the SysTick peripheral
  9. In the last part of main(),
    • create a while(1) do-forever loop
    • turn off all of the LEDs
    • turn on the current LED color
    • delay for 4 seconds
    • turn off the current LED color
    • delay for 4 seconds
  10. In mydelay(), you will need to get into the low-level details to poll the SysTick peripheral.
    • using HWREG macro to transfer the reload register value to the count register
    • create a loop to count a 4 second delay based 0.2 second delay created by SysTick
    • use HWREG macro to check the COUNT flag in the SysTick control register
    • Last hint: here's where you want to check button_poll and use the BUTTON_PRESSED macro.

REQUIREMENTS

  • Code is formatted correctly (proper indentation, descriptive names, no ``magic'' numbers, appropriate comments).
  • explicitly set the clock frequency to 80 MHz
  • add (and use) button.c and button.h to debounce switches
  • SW1 turns LED red, SW2 turns LED green
  • complete on-(4s)delay or off-(4s)delay cycle before switching colors
  • before deadline, upload code

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!