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 with avrstudio4.0

Status
Not open for further replies.

yogi

Full Member level 6
Joined
Jan 8, 2005
Messages
336
Helped
22
Reputation
44
Reaction score
5
Trophy points
1,298
Activity points
2,177
can you tell me what is wrong with the following code. In that code when analog comparator output is high the counter should work but it is not working. I checked output of the T flag and analog comparator they are high then also counter is not working. Can you correct the code

I am also facing probs when I am using 'rcall'
Till now I am able to use only 'rjmp'

I am using avrstudio4.0, avrdude programmer, atmega8515

The other problem i am facing is of delay
avrstudio shows delay 139ms for 4MHz and if i use the following
delay function for 8MHz I am getting of delay b/w .5 to 1sec






.cseg
.org 0

rjmp RESET

RESET:
ldi r16,0xff
out $14,r16 ;PORTC as output
out $1a,r16
out $11,r16
ldi r16,0x08
out $08,r16
ldi r18,00
ldi r17,01

LOOP:
in r16,$08
out $1b,r16
bst r16,5 ;moving Bit5 of the analog comp.
;register to T flag(Bit copy storage)
in r11,$3f
out $12,r11
brts counter
rjmp LOOP

counter:

add r18,r17
out $15,r18
rjmp delay


delay:
; -----------------------------
; delaying 555552 cycles:
ldi R19, $04
WGLOOP0: ldi R18, $C5
WGLOOP1: ldi R20, $EA
WGLOOP2: dec R20
brne WGLOOP2
dec R18
brne WGLOOP1
dec R19
brne WGLOOP0
; -----------------------------
; delaying 3 cycles:
ldi R19, $01
WGLOOP3: dec R19
brne WGLOOP3
; =============================
rjmp LOOP
 

initialize the stack pointer first as the first statement after reset label
 

can u give a simple code so that
i can work with rcall, brne

Thanxs
 

you can go to atmel site and look for application notes .
 

i am not able to get any examples or application notes from www.atmel.com

can u tell me how to get it

can u give some beginner programms
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top