Maker Pro
Maker Pro

ATMEGA16 USART problem

[email protected]

Jan 25, 2014
1
Joined
Jan 25, 2014
Messages
1
Hi, i am using ATMEGA16 microcontroller with external crystal frequency 12 MHz. when i am running the code of USART, i does't get any data on hyperterminal, plz help me out..
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,505
Joined
Jan 21, 2010
Messages
25,505
Are you using the arduino environment?

Have you chosen or compiled a bootloader designed for 12MHz? I believe the code gets and uses the clock speed to set things like delays and UART settings. (I'd have to check that, but you do need to set things up correctly so the code knows the actual clock speed)
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
12,615
Joined
Nov 17, 2011
Messages
12,615
Welcome to the forum.

We need more information to be able to help.
Post the relevant sections of your code (Initialization of the µC and UART code)..
Also show how you connect the ATmega to the PC (RxD TxD crossed?)
 

OLIVE2222

Oct 2, 2011
690
Joined
Oct 2, 2011
Messages
690
Hi,

Also 12MHz don't allow all baudtrate check here:
http://www.wormfood.net/avrbaudcalc.php
Fuse bits must also be set for external crystal (not the default value if my memory serve me well).

You can check the clock with a dumb 1 second interval led blink.

Olivier
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,505
Joined
Jan 21, 2010
Messages
25,505
You can check the clock with a dumb 1 second interval led blink.

It might sound dumb, but In every project I build with a microcontroller I include at least 2 things:

1) a programming header
2) A LED controlled by the microcontroller.

The first code I load simply flashes the LED. You'd be surprised how much it tests (Well, Olive2222 might not be)
 

gorgon

Jun 6, 2011
603
Joined
Jun 6, 2011
Messages
603
I always design a project with an 'I'm alive' LED. If I have spare outputs, I always add a couple of status LEDs too.

The LED output(s) can also be a stand in for a debug output. Good to have if you have a timing issue, or an interupt latency problem. Using a scope you can see everything from Serial fault codes to timing pulses.
 
Top