Question: please I would like help completing this code: Add PLL.c, PLL.h, UART.c, UART.h, tm4c123gh6pm.h in your program. Copy the content of the following files into
please I would like help completing this code:
Add PLL.c, PLL.h, UART.c, UART.h, tm4c123gh6pm.h in your program.
Copy the content of the following files into your main program.
| // U0Rx (VCP receive) connected to PA0 // U0Tx (VCP transmit) connected to PA1
#include "PLL.h" #include "UART.h"
// **************Average3 Function***************** // Write a function that calculates the average of three numbers // Inputs: x,y,z 32-bit unsigned numbers // Output: average of x,y,z uint32_t Average3(uint32_t x, uint32_t y, uint32_t z){ // write code here return 0; // replace this line with solution } // **************Max3 Function***************** // Write a function that calculates the maximum of three numbers // Inputs: x,y,z 32-bit unsigned numbers // Output: maximum of x,y,z uint32_t Max3(uint32_t x, uint32_t y, uint32_t z){ // write code here
return 0; // replace this line with solution } uint32_t Data[10]={100,200,500,300,400,700,300,0,600,400}; // **************Max10***************** // Write a function that calculates the maximum of 10 numbers // Inputs: 10 numbers in Data array // Output: maximum of these 10 numbers uint32_t Max10(void){ // write code here
return 0; // replace this line with solution } uint8_t Data2[4]={1,2,3,4}; // change it to 4,3,2,1 // **************Reverse4***************** // Write a function that reverses the order of numbers in a 4-element array // Inputs: 4 numbers in Data2 array // Output: modify the array reversing the order void Reverse4(void){ // write code here
} uint8_t Data3[11]={0,1,2,3,4,5,6,7,8,9,10}; // change it to 10,9,8,7,6,5,4,3,2,1,0 // **************Reverse11***************** // Write a function that reverses the order of numbers in an 11-element array // Inputs: 11 numbers in Data3 array // Output: modify the array reversing the order void Reverse11(void){ // write code here
} //testing code int main(void){uint32_t i;
PLL_Init(Bus80MHz); // 80 MHz UART_Init(); // initialize UART
UART_OutString(" Test of Average3, correct=3000, your= "); UART_OutUDec(Average3(1000,2000,6000)); UART_OutString(" Test of Max3, correct=6000, your= "); UART_OutUDec(Max3(1000,2000,6000)); UART_OutString(" Test of Max3, correct=6000, your= "); UART_OutUDec(Max3(1000,6000,2000)); UART_OutString(" Test of Max3, correct=6000, your= "); UART_OutUDec(Max3(6000,2000,1000)); UART_OutString(" Test of Max3, correct=6000, your= "); UART_OutUDec(Max3(2000,1000,6000)); UART_OutString(" Test of Max3, correct=6000, your= "); UART_OutUDec(Max3(2000,6000,1000)); UART_OutString(" Test of Max3, correct=6000, your= "); UART_OutUDec(Max3(6000,1000,2000)); UART_OutString(" Test of Max10, correct=700, your= "); UART_OutUDec(Max10()); UART_OutString(" Test of Reverse4, correct=4 3 2 1, your= "); Reverse4();
for(i=0;i<4;i++){ UART_OutUDec(Data2[i]); UART_OutChar(' '); }
UART_OutString(" Test of Reverse11, correct=10 9 8 7 6 5 4 3 2 1 0, your= "); Reverse11(); for(i=0;i<11;i++){ UART_OutUDec(Data3[i]); UART_OutChar(' '); }
UART_OutString(" "); while(1){ } } |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
