File: interrupt.S

package info (click to toggle)
kuttypy 2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 37,896 kB
  • sloc: python: 58,651; javascript: 14,686; xml: 5,767; ansic: 2,716; makefile: 453; asm: 254; sh: 48
file content (32 lines) | stat: -rw-r--r-- 642 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32

#include <avr/io.h>

.section .text    ; denotes code section

.global __vector_1       ; INT0_vect 
__vector_1:
  INC R1
  STS PORTB, R1
  RETI

.global main
main:
  LDI R16, 255
  STS DDRB, R16           ; port B as output
  LDI R16, 0b11111011
  STS DDRD, R16           ; only pin  PD2 as input

  COM R16                 ; enable Pull-up only on PD2, INT0
  STS PORTD, R16

  LDI R16, 2              ; make INT0 trigger on falling edge
  STS MCUCR, R16

  LDI R16, 0x40      ; enable INT0 enable bit of GICR
  STS GICR, R16   
  CLR R1
  SEI                ; enable interrupts

loop:                ; infinite wait loop
  RJMP loop
.end