SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions on the software and hardware for Atmel's STK standard.
By YellowFlower
Hi Guys,

I'm really stuck, after working on the tutorial shown on the sparkfun website on hooking the ATmega8/168/328 to RS232 i've gotten it to the point where if i loop the MAX232 it works great. i can get the LED to light up as per the initial programming tutorial. i have hooked the ATmega328 to the MAX232 and followed the code examples in the 328 Datasheet.

BUT it will not send data to the hyperterminal.

here is my code.
Code: Select all
#include <avr/io.h>

void USART_Init() {
             // BAUD 2400, No Parity, 1 Stop Bit, Asyncronous
	UCSR0A = 0x00;
	UCSR0B = 0x18;
	UCSR0C = 0x86;
	UBRR0H = 0x00;
	UBRR0L = 0x33;

void USART_Transmit( unsigned char data ) {

	// Wait for empty transmit buffer */
	while ( !( UCSR0A & UDRE0) );
	// Put data into buffer, sends the data */
	UDR0 = data;

int main() {
// status LED
DDRC = 255;
PORTC = 255;



return 0;
any help would be awesome!!!

oh and on occasion when i try to save/build the project is get the following error
"Encountered a Sharing Violation while accessing
C:\Users\Matt\Documents\AVR Projects\Serial328\MFC31C1.tmp."
im using windows 7.
however i can still retry the save/build and it works fine.

oh and yes. hyperterminal is setup for the BAUD rate etc etc.

By YellowFlower
ok poeple... solved it.

my BAUD rate was not correct as the ATmega328's default clock frequency is 1MHz and not 8MHz.
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]