Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Code Composer Studio with board EK-TM4C123GXL write a code implementing the following: - In addition to main(), you will create two new functions: blink()

Using Code Composer Studio with board EK-TM4C123GXL write a code implementing the following:

- In addition to main(), you will create two new functions: blink() and delay().

- Use main() to set up the clock rate and enable GPIO port associated red and blue LEDs.

- Use blink() that takes three arguments: the first specifies the color, the blink rate, and the last is how many times to blink the color.

- Use delay() to write a do-nothing loop that simply consumes time.

in order to do the following:

blink the blue LED five times (1s on, 1s off) for a total of 10s, (b) blink the red LED ten times (0.5s on, 0.5s off), repeat (a)-(b) until the power is removed.

Here is an example:

#include #include #include "inc/hw_memmap.h" #include "driverlib/debug.h" #include "driverlib/gpio.h" #include "driverlib/sysctl.h"

#ifdef DEBUG void __error__(char *pcFilename, uint32_t ui32Line) { while(1); } #endif

int main(void) { volatile uint32_t ui32Loop;

// // Enable the GPIO port that is used for the on-board LED. // SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);

// // Check if the peripheral access is enabled. // while(!SysCtlPeripheralReady(SYSCTL_PERIPH_GPIOF)) { }

// // Enable the GPIO pin for the LED (PF3). Set the direction as output, and // enable the GPIO pin for digital function. // GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_3);

// // Loop forever. // while(1) { // // Turn on the LED. // GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3, GPIO_PIN_3);

// // Delay for a bit. // for(ui32Loop = 0; ui32Loop < 200000; ui32Loop++) { }

// // Turn off the LED. // GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_3, 0x0);

// // Delay for a bit. // for(ui32Loop = 0; ui32Loop < 200000; ui32Loop++) { } } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

Students also viewed these Databases questions

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago