Nugroho's blog.: Timer on ATTiny13A using Interrupt

Tuesday, May 26, 2015

Timer on ATTiny13A using Interrupt


 It started with this

.include "../tn13Adef.inc" 
.org 0000 
rjmp reset 
.org 0003 
rjmp timer

reset:
sbi ddrb,0           
ldi r16,0b00000101    
out tccr0b,r16
ldi r16,0b00000010    
out timsk0,r16
sei

loop:
ldi r16,(1<<SE)
out mcucr,r16
sleep
rjmp loop

timer:
sbi   pinb,0       

reti




Nugrohos-MacBook-Air:timer nugroho$ avra -o timer.hex timer.s 
AVRA: advanced AVR macro assembler Version 1.3.0 Build 1 (8 May 2010)
Copyright (C) 1998-2010. Check out README file for more info

AVRA is an open source assembler for Atmel AVR microcontroller family
It can be used as a replacement of 'AVRASM32.EXE' the original assembler
shipped with AVR Studio. We do not guarantee full compatibility for avra.

AVRA comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of avra under the terms
of the GNU General Public License.
For more information about these matters, see the files named COPYING.

Pass 1...
Pass 2...
done

Used memory blocks:
Code : Start = 0x0000, End = 0x0000, Length = 0x0001
Code : Start = 0x0003, End = 0x000F, Length = 0x000D

Assembly complete with no errors.
Segment usage:
Code : 14 words (28 bytes)
Data : 0 bytes
EEPROM : 0 bytes
Nugrohos-MacBook-Air:timer nugroho$ vavrdisasm timer.s.hex
0: c0 03 rjmp .+6 ; 0x8
6: c0 0a rjmp .+20 ; 0x1c
8: 9a b8 sbi $17, 0
a: e0 05 ldi R16, 0x05
c: bf 03 out $33, R16
e: e0 02 ldi R16, 0x02
10: bf 09 out $39, R16
12: 94 78 sei
14: e2 00 ldi R16, 0x20
16: bf 05 out $35, R16
18: 95 88 sleep
1a: cf fc rjmp .-8 ; 0x14
1c: 9a b0 sbi $16, 0
1e: 95 18 reti
Nugrohos-MacBook-Air:timer nugroho$

.

No comments:

323f (5) amp (1) android (12) apple (7) arduino (18) art (1) assembler (21) astina (4) ATTiny (23) blackberry (4) camera (3) canon (2) cerita (2) computer (106) crazyness (11) debian (1) delphi (39) diary (286) flash (8) fortran (6) freebsd (6) google apps script (8) guitar (2) HTML5 (10) IFTTT (7) Instagram (7) internet (12) iOS (5) iPad (6) iPhone (5) java (1) javascript (1) keynote (2) LaTeX (6) lazarus (1) linux (29) lion (15) mac (28) macbook air (8) macbook pro (3) macOS (1) Math (3) mathematica (1) maverick (6) mazda (4) microcontroler (35) mountain lion (2) music (37) netbook (1) nugnux (6) os x (36) php (1) Physicist (29) Picture (3) programming (189) Python (109) S2 (13) software (7) Soliloquy (125) Ubuntu (5) unix (4) Video (8) wayang (3) yosemite (3)