added interrupt examples

This commit is contained in:
Fernando 2025-03-07 11:29:54 -06:00
parent f4fdcb11c1
commit 47d91da1fa
10 changed files with 13 additions and 22 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.lst
*.cod

0
README.md Normal file → Executable file
View File

View File

@ -22,7 +22,7 @@ clean:
rm -f $(SRC:.c=.asm) $(SRC:.c=.cod) $(SRC:.c=.hex) $(SRC:.c=.lst) $(SRC:.c=.o)
program:
pk2cmd -M -P${PPROC} -Fout.hex
pk2cmd -M -P${PPROC} -Fmain.hex
asm: *.asm
gpasm -p ${ASMPROC} -o main.hex $^

0
blink/main.hex Normal file → Executable file
View File

0
cuenta/main.hex Normal file → Executable file
View File

5
interrupt/main.asm Normal file → Executable file
View File

@ -40,8 +40,8 @@ MAIN_LOOP:
; === Interrupt Service Routine ===
ISR:
BTFSS INTCON, RBIF ; Check if RB Change interrupt occurred
RETFIE ; Return if not triggered
;BTFSS INTCON, RBIF ; Check if RB Change interrupt occurred
;RETFIE ; Return if not triggered
;BTFSS INTCON, INT0IF
;RETFIE
@ -58,6 +58,7 @@ ISR:
BCF INTCON, RBIF ; Clear the RBIF flag
BCF INTCON, INT0IF
BCF INTCON, INT1IF
RETFIE ; Return from interrupt
END

8
interrupt/main.hex Normal file → Executable file
View File

@ -1,10 +1,10 @@
:020000040000FA
:0400000006EF00F017
:0800080019EF00F0FF0E936EEA
:0800080017EF00F0FF0E936EEC
:10001000956A8C6A0F0EC16EF19EF180F286F28EA7
:10002000F28CF288F18CF286F18A81CF83FF15EF92
:1000300000F0F2A01000815000000000000000005D
:0A00400081CF83FFF290F2921000CE
:10002000F28CF288F18CF286F18A15EF00F08150A3
:10003000000000000000000081CF83FFF290F292E8
:04004000F29010002A
:020000040030CA
:04000000000C1F1EB3
:020005008381F5

0
menu_rota/main.hex Normal file → Executable file
View File

View File

@ -24,18 +24,7 @@ Start:
MOVWF TRISB
loop:
movlw 0xff
addwf PORTB
btfsc STATUS, 0
goto on
goto off
on:
movlw 0x01
movwf PORTD
movff PORTB, PORTD
goto loop
off:
movlw 0x00
movwf PORTD
goto loop
END ; End of program

3
test/main.hex Normal file → Executable file
View File

@ -1,7 +1,6 @@
:020000040000FA
:10000000956A8C6A8A6AF19E0F0EC16EFF0E936E1E
:10001000FF0E8126D8B00FEF00F013EF00F0010EB5
:0E002000836E08EF00F0000E836E08EF00F014
:0800100081CF83FF08EF00F02F
:020000040030CA
:04000000000C1F1EB3
:02000500038175