1

Im trying to display A on TERA TERM simulator but when i run my code on ATMEL STUDIO 7 the code doesn't stop running.

This is my code below i am running the program on the simulator tool available on atmel studio 7 and i believe i am configuring the UART correctly

#include <avr/io.h>

void configureUART(void);
void sendUART(unsigned char);

int main(void)
{
configureUART();

sendUART('A');
}

void sendUART(unsigned char transmitByte)
{
    while ((UCSRA & (1 << UDRE))== 0);
    // Data register is ready, transmit out the byte.
    UDR = transmitByte;
}

void configureUART()
{
    //Baud Rate Config 9600 => 0x4D
    UBRRH = 0x00;
    UBRRL = 0x4D;

    //Need to use UCSRC Register w/ asynchronous op. and 1 stop bit w/ 8 data bits
    UCSRC = (1 << URSEL) | (0 << USBS) | (1 << UCSZ0) | (1 << UCSZ0) ;
    //Transmit and Receive
    UCSRB = (1 << RXEN) | (1 << TXEN); 
}

0 Answers0