Question: #include #include #include #include #include TM 4 C 1 2 3 GH 6 PM . h #include MyDefines.h void DelayMs ( int

#include
#include
#include
#include
#include "TM4C123GH6PM.h"
#include "MyDefines.h"
void DelayMs(int ms); // Software Delay Function
void SegDisplay(uint8_t d);
void Setup_GPIO(void);
// You nave to finish the following array for Seven Segment Display
char SevenSeg[]={0x3f,//0
0x06,//1
// You have to finish this array for 7-seg display
};
int main()
{
char ch =0;
int i =0;
// Place your initialization/startup code here (e.g. Setup_GPIO())
Setup_GPIO();
while (1){
// Place your application code here
for (i =0; i sizeof(SevenSeg); i++){
SegDisplay(ch & 0x0F);
ch++;
DelayMs(1000);
}
}
}
//------------------------------------------------------------------------------
void SegDisplay(uint8_t d)
{
char seg;
seg = SevenSeg[?];
}
//------------------------------------------------------------------------------
/*
Device Port.Pins DIR DriveMode
Seg-a
Seg-b
Seg-c
Seg-d
Seg-f
Seg-g
Seg-dp
SW1
SW2
Port ____
*/
void Setup_GPIO(void)
{
// Configure GPIOs
//1. Enable Clock to the GPIO Modules (SYSCTL->RCGCGPIO |=(_PORTs);)
SYSCTL->RCGCGPIO |=(__);
// allow time for clock to stabilize (SYSCTL->PRGPIO & (_PORTs))
while((SYSCTL->PRGPIO & (__))!=(__)){};
//2. Unlock GPIO only PD7, PF0 on TM4C123G; PD7, PE7 on TM4C1294(GPIOx->LOCK =0x4C4F434B; and GPIOx->CR =_PINs;)
GPIOD->LOCK =0x4C4F434B;
GPIOD->CR |=_PIN7;
GPIOD->LOCK =0;
GPIOF->LOCK =0x4C4F434B;
GPIOF->CR |=_PIN0;
GPIOF->LOCK =0;
//3. Set Analog Mode Select bits for each Port (GPIOx->AMSEL =_PINs; 0=digital, 1=analog)
//4. Set Port Control Register for each Port (GPIOx->PCTL = PMCn _PTCL_PINn, check the PCTL table)
//5. Set Alternate Function Select bits for each Port (GPIOx->AFSEL =_PINs; 0=regular I/O,1=PCTL peripheral)
//6. Set Output pins for each Port (Direction of the Pins: GPIOx->DIR =_PINs; 0=input, 1=output)
//7. Set PUR bits (internal Pull-Up Resistor), PDR (Pull-Down Resistor), ODR (Open Drain) for each Port (0: disable, 1=enable)
//8. Set Digital ENable register on all port.pins (GPIOx->DEN =_PINs; 0=disable, 1=enable)
}
//------------------------------------------------------------------------------
// Delay ms milliseconds (16MHz CPU Clock)
void DelayMs(int ms)
{
volatile int i, j;
for (i =0; i ms; i++)
for (j =0; j 4167; j++){}// Do nothing for 1ms
} interface a seven-segment display to Tiva LaunchPad. The display counts from \(0\sim \) F \begin{tabular}{|c|c|c|c|c|c|c|}
\hline Device & Port.Pin & \begin{tabular}{c}
Signal \\
Type
\end{tabular} & & Direction & \begin{tabular}{c}
Drive \\
Mode
\end{tabular}\\
\hline Seg-a & PA2 & Digital & 0-GPIO & OUT/POS & \\
\hline Seg-b & PA3 & Digital & 0-GPIO & OUT/POS & \\
\hline Seg-c & PA4 & Digital & 0-GPIO & OUT/POS & \\
\hline Seg-d & PC4 & Digital & 0-GPIO & OUT/POS & \\
\hline Seg-e & PC5 & Digital & 0-GPIO & OUT/POS & \\
\hline Seg-f & PC6 & Digital & 0-GPIO & OUT/POS & \\
\hline Seg-g & PC7 & Digital & 0-GPIO & OUT/POS & \\
\hline Seg-dp & PD7 & Digital & 0-GPIO & OUT/POS & \\
\hline \begin{tabular}{ll}
SW1(On-bo-
\end{tabular} & PF4 & Digital & 0-GPIO & IN/NEG & UP \\
\hline \begin{tabular}{ll}
SW2(On-bo
\end{tabular} & Digital & 0-GPIO & IN/NEG & \\
\hline
\end{tabular} Lab Experiments
Comment out the for-loop code in the main function inside the while-loop.
```
while (1){
// Place your application code here
// for (i =0; i sizeof(sevenSeg); i++){
// SegDisplay(ch & 0x0F);
// ch++;
// DelayMs(1000);
//}
}
```
#include #include #include #include #include " TM

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 Programming Questions!