Help With "Hello World"

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have been trying to get my first HELLO WORLD program with an LCD working and I need some hints if possible.

 

I am using an ATMEGA 32A running at 1MHz (checked roughly with a blinking LED) and an LCD, Part 782 from adafruit with serial backpack that runs at 9600 baud that I have not changed.

 

I am coming from Pin 15 of the 32A to the input of the backpack which has a common ground and 5V with the 32A.

 

When I run the attached program I get repeated garbage characters (more than what I am transmitting).

 

I am using ATMEL Studio 7.0.1006 with an USBTiny to burn the 32A. I did burn the blinking LED program successfully.

 

Any assistance will be greatly appreciated, it seems that it can't be anything too complicated but I can't find the error(s). Program attached.

 

Many thanks  Dave

 

 

Attachment(s): 

David Abineri

Last Edited: Mon. Dec 4, 2017 - 11:30 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Are you sure you are running the AVR at 1MHZ? I get confused if the mega32 has the DIV8 fuse in it. If it does not then the AVR is running at 8MHZ

And using the internal oscillator is not a good idea...it drifts with temperature

Post a schematic if you can as well

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can't get 9600 baud with a 1MHz AVR (unless you use the U2X bit)

 

Either change your backpack to run at 4800 baud or change your usart_init() function to use U2X.

#define BAUD_PRESCALLER (((F_CPU / (BAUDRATE * 8UL))) - 1) //cos we use U2X
...
 		UCSR0B = (1<<TXEN0)|(1<<U2X0);	//(1<<RXEN0)       //CHECK datasheet 
...

The Mega32 does not have a prescaler.   You set fuses for 1MHz, 2MHz, 4MHz, 8MHz.

Unfortunately the calbration is only good for 1MHz.   If you change fuses,  you might have to change OSCCAL

 

David.

Last Edited: Mon. Dec 4, 2017 - 11:19 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Basically the same question that was in your other thread and the same answer. Do you expect magic if you ask the same thing a third time?
What have the previous answers not been able to help you with?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

GRRRRRR!!!

 

Stick to the other thread!

 

Locked

 

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB user

Topic locked