Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[AVR] UART in AVR Studio6.1 problem

Status
Not open for further replies.

sundar-edaboard

Junior Member level 1
Junior Member level 1
Joined
Sep 5, 2013
Messages
19
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Location
Bahrain
Visit site
Activity points
131
Hi,

I am using ATMEGA16A controller in avr studio 6.1 version and windows 8.1.

The UART register UCSRA value is not able to update in simulation. What is the reason?


#include <avr/io.h>
#include <avr/interrupt.h>

void TransmitByte( unsigned char data )
{
while((UCSRA&(1<<UDRE)) == 0);
UDR = data;
}

int main (void)
{

char data;
UBRRH=0;
UBRRL=103; // 9600 & 16mhz
UCSRB |= (1 << RXEN) | (1 << TXEN) ; // Turn on the transmission and reception circuitry
UCSRC |= (1 << URSEL) | (1 << UCSZ0) | (1 << UCSZ1); // Use 8-bit character sizes

while (1)
TransmitByte(']');

}
 

Yes. I tried this example code also.

The values in the UCSRC register in the simulator is not updating. I was running the code step by step.

code for Timer, GPIO, EEPROM, Interrupts are working fine. But facing problem only with UART programming.

How to include ATmega16A in AVR studio 4?
 

What do you mean by include ATMEGA16A ? If you create a project fro ATMega16A then you have that device for debugging.
 

It is not related to compiler version problem i think you need to set TXC bit manually while you are using simulator. In real time it sets automatically for successful data transfer, so if you set your TXC bit I think you will able to run your UART simulation
 

when I initialize the UART the Register value of UCSRC is not updating inn simulator. After executing the below lines the UCSRC value remains 0x00 only.
UCSRC |= (1 << URSEL) | (1 << UCSZ0) | (1 << UCSZ1); // Use 8-bit character sizes, no parity, 1stopbit

In simulator and real time, the UART is not working.

Please help me.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top