Krolyxon
Commit 6efefdd

Branches

Tags

Refs →

bench51examplesbutton_int0.asm

20 lines · 570 B · x86_64 Assembly

1; External interrupt 0 (falling edge on P3.2) counts button presses into P1.
2; In debug mode, Tab to the Ports panel, select P3 bit 2 and press Space
3; twice (press + release) to generate one falling edge.
4
5 ORG 0000h
6 LJMP main
7
8 ORG 0003h ; INT0 vector
9 INC P1
10 RETI
11
12 ORG 0030h
13main: MOV P1,#00h
14 SETB IT0 ; edge-triggered
15 SETB EX0
16 SETB EA
17sleep: ORL PCON,#01h ; idle until an interrupt arrives
18 SJMP sleep ; ...and go back to idle afterwards
19
20 END