Question: i need my code in keill u vision to use these parameters for teraterm. Baud Rate 1 1 5 2 0 0 8 bits, odd

i need my code in keill u vision to use these parameters for teraterm.
Baud Rate
115200
8 bits, odd parity, 1 stop bits
Prescaler
-:8
#include
#include
#include
#include "TM4C129.h"
#include "Lab2_Thu.h"
#include "TM4C1294NCPDT.h"
// Function to setup GPIO for UART6
void setup_GPIO(void){
// Enable the clock for GPIO Port P
SYSCTL->RCGCGPIO |=(1<<12); // Enable clock for GPIO Port P
while ((SYSCTL->PRGPIO & (1<<12))==0); // Wait for the clock to be ready
// Enable the clock for UART6
SYSCTL->RCGCUART |=(1<<6); // Enable clock for UART6
while ((SYSCTL->PRUART & (1<<6))==0); // Wait for the clock to be ready
// Configure GPIO pins for UART6
GPIOP->AFSEL |=(1<<0)|(1<<1); // Enable alternate function on PP0 and PP1
GPIOP->PCTL =(GPIOP->PCTL & ~0x000000FF)|(0x00000001<<0)|(0x00000001<<4); // Set PCTL for UART6
GPIOP->DEN |=(1<<0)|(1<<1); // Enable digital function on PP0 and PP1
}
// Function to setup UART6
void setup_UART(void){
// Disable UART6 before configuration
UART6->CTL &= ~0x00000001; // Clear UARTEN bit to disable UART
// Set baud rate
uint32_t brd =80000000/(16*115200); // Integer part of the BRD
uint32_t fbrd =(80000000%(16*115200))*64/(16*115200)+0.5; // Fractional part of the BRD
UART6->IBRD = brd;
UART6->FBRD = fbrd;
// Set UART6 configuration: 8-bit data, odd parity, 1 stop bit
UART6->LCRH =(0x60)|(0x08)|(0x10)|(0x04);
// Enable UART6
UART6->CTL =0x00000301; // UARTEN | TXE | RXE
}
int main(void){
uint8_t c;
setSysClk80MHz(); // Do NOT remove. Set the System clock to 80MHz
RedirectOutput(); // Do NOT remove. Redirect output from U3 to the terminal via U4
setup_GPIO(); // Setup GPIO for UART
setup_UART(); // Setup UART
banner("Start typing. You should see the keys echoed on the terminal");
// ECHO loop
while (1){
// Echo keys back to you
// This tests your connection
c = read_UART(); // Read from UART (make sure this function reads from UART6)
write_UART(c); // Write to UART (make sure this function writes to UART6)
}
return 0;
}

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!