Question: Need help fixing this code. #include TM 4 C 1 2 9 . h #include Lab 2 _ Thu.h #include TM
Need help fixing this code. #include TMCh
#include "LabThu.h
#include TMCNCPDTh
Function to setup GPIO for UART
void setupGPIOvoid
Enable the clock for the GPIO port that UART uses assuming it's port P
SYSCTLRCGCGPIO ; Enable clock for GPIO Port P
while SYSCTLPRGPIO & ; Wait for the clock to be ready
Enable the clock for UART
SYSCTLRCGCUART ; Enable clock for UART
while SYSCTLPRUART & ; Wait for the clock to be ready
Configure GPIO pins for UART
GPIOPAFSEL ; Enable alternate function on PP and PP
GPIOPPCTL GPIOPPCTL & ~xFFxx; Set PCTL for UART
GPIOPDEN ; Enable digital function on PP and PP
Function to setup UART
void setupUARTvoid
Disable UART before configuration
UARTCTL & ~UARTCTLUARTEN; ERROR
Set baud rate
uintt brd ; Integer part of the BRD
uintt fbrd ; Fractional part of the BRD
UARTIBRD brd;
UARTFBRD fbrd;
Set UART configuration: bit data, odd parity, stop bit
UARTLCRH UARTLCRHWLEN UARTLCRHPEN UARTLCRHEPS UARTLCRHSTP; ERROR
Enable UART
UARTCTL UARTCTLUARTEN UARTCTLTXE UARTCTLRXE; ERROR
int mainvoid
uintt c;
setSysClkMHz; Do NOT remove. Set the System clock to MHz
RedirectOutput; Do NOT remove. Redirect output from U to the terminal via U
setupGPIO; Rewrite function for Part
setupUART; Rewrite function for Part
bannerStart typing. You should see the keys echoed on the terminal";
ECHO loop
while
Echo keys back to you
This tests your connection
c readUART; Read from UART rewrite function for Part
writeUARTc; Write to UART rewrite function for Part
return ;
THIS CODE IS ON KEIL UVISION FOR TIVA BOARD, TO MEET TASK:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
