Atmega162 Serial Communication

Your source for all things Atmel.

Moderator: phalanx

Post Reply
Ameya
Posts: 2
Joined: Wed Jan 28, 2015 11:02 am

Atmega162 Serial Communication

Post by Ameya » Wed Jan 28, 2015 11:07 am

I had a doubt regarding serial communication of Atmega 162
Can any one help please??
I have initialized the USART by setting bits in UCSRB and UCSRC and passed a value in UDR register..but not able to see anything on Serial port of my PC
I am using 8 bit frame with 1 stop bit.
I have written a simple code shown below.
Please help

#include <avr/io.h>
#include <util/delay.h>

#define F_CPU 10000000
#define BAUD 9600
#define UBRR ((F_CPU/16UL/BAUD)-1)

int main(void)
{

UBRR0H = (UBRR >>8);
UBRR0L = UBRR;
UCSR0B = (0<<UCSZ02) | (1<<TXEN0);
UCSR0C = (1<<UCSZ01) | (1<<UCSZ00) | (1<<URSEL0) | (0<<UMSEL0) | (0<<USBS0);
while(1)
{
UDR0 = 0X55;
_delay_ms(100);
}
}
Last edited by Ameya on Thu Jan 29, 2015 6:04 am, edited 1 time in total.

stevech
Support Volunteer
Posts: 2907
Joined: Sat Jun 05, 2004 8:51 pm
Location: USA, California

Re: Atmega162 Serial Communication

Post by stevech » Wed Jan 28, 2015 10:54 pm

why not start with a working example?

Ameya
Posts: 2
Joined: Wed Jan 28, 2015 11:02 am

Re: Atmega162 Serial Communication

Post by Ameya » Thu Jan 29, 2015 8:15 am

@stevech, Can you please suggest me any working example to start with??

User avatar
Ross Robotics
Support Volunteer
Posts: 2007
Joined: Thu Jun 07, 2012 9:33 pm
Contact:

Re: Atmega162 Serial Communication

Post by Ross Robotics » Thu Jan 29, 2015 8:27 am

First link on a Google search: http://www.avrfreaks.net/forum/newbie-a ... on-problem

I just searched your title..

It's amazing how many people that don't know how to search..
------------------------------------------------------------------------------------------------------------------------------------------------------------
//codlink
Available for circuit and PCB design, just PM me!

skimask
Support Volunteer
Posts: 1244
Joined: Sun Nov 09, 2008 2:11 am
Location: Minot, N.D.

Re: Atmega162 Serial Communication

Post by skimask » Thu Jan 29, 2015 1:04 pm

codlink wrote:First link on a Google search: http://www.avrfreaks.net/forum/newbie-a ... on-problem

I just searched your title..

It's amazing how many people that don't know how to search..
Amazing?
Or appalling?
I ignore "one post wonders".

User avatar
Ross Robotics
Support Volunteer
Posts: 2007
Joined: Thu Jun 07, 2012 9:33 pm
Contact:

Re: Atmega162 Serial Communication

Post by Ross Robotics » Thu Jan 29, 2015 5:04 pm

I used amazing to be somewhat respectful.. But appalling would be a good one.
------------------------------------------------------------------------------------------------------------------------------------------------------------
//codlink
Available for circuit and PCB design, just PM me!

Post Reply