Question: 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

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!