Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Avr Not working!!

Status
Not open for further replies.

kemo0o

New Member
Hey ;

i have atmega32 i programmed it by ponyprog :rolleyes:
it tells me (( write successful)) but when i put it on bread board and put it into the circuit it doesn't work (( NO o/p)

What is the sol. ????????
 
my program works on proteus with no problems
but in fact it doesn't work ? idon't know why
may be the mega32 is not working ??

may be the mega32 not working but it could be programmed ?
 
Really not enough info to guess. I use AVR Dragon and AVR Studio, so not familiar with your programmer. Can you verify or read back what was written to the chip? If the program is in the chip, you know chip is probably good, and need to look for another problem. Checked your fuse bits? I've only changed a few, but know you can do some messed up stuff if not set right.
Is the chip being powered correctly? Checked your data sheet? Is your program actually working code? I/Os set proper?

You need to post some pictures, schematics, and code if you hope to receive more then wild guesses or basic troubleshooting. You haven't even given a hint as to what your chip is suppose to do, or what sort of experience you have.

Is the chip expecting an external oscillator, but you haven't provided one?
 
this is my code and sch

Code:
; WORKING ON 4MHZ CRYSTAL 


.include "m32def.inc"
.cseg

; ////Definitions////;
.DEF TMP = R16					;
.DEF LMF = R17					;
.DEF RMF = R18					;
.DEF SW  = R19					;
.DEF LF  = R20					;
.DEF LS  = R21					;
.DEF R_PWM = R22
.DEF L_PWM = R23



.ORG $000
RJMP START
;;;;;;;;;;;;;;;;;;;;;;
.ORG $014
RJMP TIM0_COMP 					; Timer0 Compare Handler INTERRUPT VECTOR

	
START:
;; ////INIT////:;;
CLI								; CLEAR ALL INTERRUPTS
LDI TMP ,HIGH(RAMEND)	
OUT SPH, TMP					; STACK POINTER HIGH
LDI TMP ,LOW(RAMEND)
OUT SPL ,TMP 					; STACK POINTER lOW							
LDI TMP , 0B00000000
OUT DDRB,TMP
OUT DDRA ,TMP
LDI TMP ,0XFF
OUT DDRC ,TMP					; PORTC AS I/P
OUT DDRD, TMP					; PORTD AS O/P



;;///////// CLEAR ALL REGISTERS///////////////////////;
CLR TMP
CLR SW
CLR R30							
CLR R31							

;//////////////////////////////////////////////////////;
;/// TIMERS FOR PWM HARDWARE   I USED TIMER 1 16 BIT///;
;//////////////////////////////////////////////////////;
LDI TMP , 0B11110001
OUT TCCR1A , TMP				; 
LDI TMP , 0B00001001			;
OUT TCCR1B,TMP

SEI

MAIN:

RCALL SWITCHES



RJMP MAIN

SWITCHES:
SWT:
IN SW,PINB
CPI SW,0B00000111
BREQ SWT
CPI SW,0B00000110
BREQ ST1
CPI SW,0B00000101
BREQ ST2
CPI SW,0B00000011
BREQ ST3
RET

ST1:							
LDI TMP , 0
OUT OCR1AH , TMP				
LDI R_PWM ,0X5a
OUT OCR1AL , R_PWM
LDI TMP , 0
OUT OCR1BH , TMP				
LDI L_PWM ,0X5a
OUT OCR1BL , L_PWM
RET

ST2:							;
LDI TMP,0B00000000
OUT PORTD,TMP
RET

ST3:							
LDI TMP,0B11111111
OUT PORTD,TMP
RET

and sch in attach


-- the problem:

when i apply power on micro it out ( LOGIC 1 ) high on PD5 , PD4 without pressing any switch

- Note : the chip is programmed and i read the program from it ?
so what is wrong ?? what about fuse bits ? i am using 4MHZ crystal
 

Attachments

  • fff.JPG
    fff.JPG
    46.2 KB · Views: 508
kemo0o said:
Waiting...................

Yeah, aren't we all...

Really not to sure about it, need to think on it some. The buttons and resistors stick out as curious, not sure if it's right or wrong. I've only used switches. The program has an Rjmp instruction to a timer interrupt routine, which I didn't see. Maybe someone else will see the problem.

If you still suspect the chip, try reprogramming it with some simple code (flash an LED) that you already know works. Not familiar enough with the PWM stuff to know if that's correct.
 
kemo0o said:
Waiting...................
Please see your schematic, I didn't find the crystal and associated pF capacitors/ Also I think you have to arrange for auto reset circuit element so that when the power is ON the circuit is reset after a while?
Please mod and then test. Let us see, whether it functions provided your software is correct.
 
Uh...............

What seems to be the officer problem?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top