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.

Problem executing program even after successfully burning in ATMega32A MCU using ASM

Status
Not open for further replies.

dsk2858

Member level 2
Joined
Aug 17, 2011
Messages
47
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Chennai,India
Activity points
1,683
Hi ,

I am using ATmega32A MCU and AVR Studio-4 .written a assembly program to glow the leds connected in PORTD.
I simulated it using AVR Studios-4 simulator ,its executing exactly as the program.
Code:
[COLOR="#FF0000"].INCLUDE "M32DEF.INC"
.ORG 0x0000
RJMP MAIN
MAIN: 	LDI R16,$FF
		LDI R17,$00
		OUT DDRD,R16
		OUT PORTD,R17
END:	RJMP END[/COLOR]

Then i burned the generated .hex file in to the ATmega32A it was no getting executing.

I tested the MCU it is fine by writing the same code using C-Language .
Code:
[COLOR="#FF0000"]#include<avr/io.h>

main()
{
DDRD=0XFF;
PORTD=0X00;
}[/COLOR]


Help me to solve the problem.
thank u
 

Sorry... But then I met C-Language, does not remember anything from asm... hehehe... :lol:
Please, try this ( I dont have asm compiler/ I using linux in this time):

Code:
.INCLUDE "M32DEF.INC"
.ORG 0
	RJMP	MAIN
MAIN:
	LDI	R16,$FF		; Load 255 in R16
	OUT	DDRD,R16	; Copy to DDRD and set output
	LDI	R16,0xAA	; Load 0 to R16
	OUT	PORTD,R16	; Copy to PORTD 0s
END:
	RJMP	END		; Goto End

This code put only all pins in low.

To flip and flop, you need a delay time function.

I found this:
http://www.avrbeginners.net/
http://www.avr-asm-download.de/beginner_en.pdf
Enjoy.
 
Last edited:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top