hi,
i m working on UART protocol i cant able to see the output on PUTTY Terminal below i attached the code please help me
#include<stdint.h>
#include<stdbool.h>
#include<driverlib/sysctl.h>
#include<inc/hw_gpio.h>
#include<inc/tm4c129xnczad.h>
void printchar( char c);
char readchar();
void printstring(char *string);
char c;
int main()
{
SYSCTL_RCGCUART_R=0x00000001; //UART0
SYSCTL_RCGCGPIO_R=(1<<0); //enable clock to porta gpio
GPIO_PORTA_AHB_AFSEL_R=(1<<0)|(1<<1);
GPIO_PORTA_AHB_PCTL_R=(1<<0)|(1<<4);
GPIO_PORTA_AHB_DEN_R=(1<<0)|(1<<1);
UART0_CTL_R&=~(1<<0);
UART0_IBRD_R=104;
UART0_FBRD_R=11;
UART0_LCRH_R=(1<<4);
UART0_CC_R=0X0;
UART0_CTL_R=(1<<0)|(1<<8)|(1<<9);
SYSCTL_RCGCGPIO_R=(1<<14);
GPIO_PORTQ_DIR_R=(1<<7)|(1<<4);
GPIO_PORTQ_DEN_R=(1<<7)|(1<<4);
GPIO_PORTQ_DATA_R &=~(1<<7)|(1<<4);
while(1)
{
printstring("enter \"r\",\"g\",or \"b\":\n\r");
c=readchar();
printchar(c);
printstring("\n\r");
switch(c)
{
case 'r':
GPIO_PORTQ_DATA_R=(1<<7); //red led on
break;
case 'g':
GPIO_PORTQ_DATA_R=(1<<4);
break;
case 'b':
GPIO_PORTQ_DATA_R=(1<<7);
break;
default:
GPIO_PORTQ_DATA_R=~((1<<7)|(1<<4));
break;
}
}
}
char readchar()
{
while((UART0_FR_R &(1<<4))!=0);
c=UART0_DR_R;
return c;
}
void printchar(char c)
{
while((UART0_FR_R &(1<<5))!=0);
UART0_DR_R=c;
}
void printstring(char *string)
{
while(*string)
{
printchar(*(string++));
}
}