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.

ATMEL AVR (90s2313) timer 1 setup

Status
Not open for further replies.

eehero

Full Member level 3
Joined
Nov 23, 2005
Messages
169
Helped
13
Reputation
26
Reaction score
5
Trophy points
1,298
Location
Libya
Activity points
2,620
timer1 timer0 atmel

hi all, i am going to setup my controller's timer "90s2313 timer1" in compare mode the code which i had written is an assembly code and shown below, some thing error may be with this code, any one can help me to detect this error can post below

.nolist
.include "2313def.inc"
.list

;.equ see=0xff00
.ORG $000
rjmp reset

.org OC1addr ;Output Compare1 Interrupt Vector Address
rjmp T1INT



reset:
ldi R16,RAMEND
out SPL,R16

LDI r16, 0b01000000 ; enable comapre interrupt
OUT TIMSK, R16

LDI r16, 0b00000101 ;set prescalar
OUT TCCR1B, R16
LDI R16,0xff
OUT TCNT1H, R16
LDI R16,0x00
OUT TCNT1L, R16
LDI R20,0x11
LDI R21,0xff
OUT OCR1AL, R20
OUT OCR1AH, R21

ser r16
out DDRB,r16
out portb,r16
sei

main:
ldi r17,0b01010101
out PORTB,r17
rjmp main


T1INT:
LDI r19, 0b00000000
out portb,r19
rcall delay100us
rcall delay100us
reti

Delay100us:
ldi r21,$88
Loop: dec r21
brne loop
ret

Added after 5 hours 37 minutes:

hi friends, i have detect my problem, the 100us delay does not allow the change on port b to be noted, so that i increase it and all thing work good.
The timer is installed in right wat
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top