You are on page 1of 3

list p=16f84, f=inhx8m, r=dec

#include <p16f84A.inc>
__config _CP_OFF & _WDT_OFF & _XT_OSC & _PWRTE_OFF
org
0x00
we come on power up and reset

;This is where

;DECLARATION OF VARIABLES
INTCON
PORTB
PORTA
TRISA
TRISB
STATUS
COUNTER1
COUNTER2
COUNTER3
COUNTER4
COUNTER5
TEMP
COUNTER11
COUNTER12
COUNTER13
COUNTER14
goto

EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU
EQU

0x0B
0x06
0x05
0x85
0x86
0X03
0x0C
0x0D
0x0E
0x0F
0x1F
0x2F
0x3F
0x4F
0x1E
0x2D

;Interrupt Control Register

main
; INTERRUPT ROUTINE

org
r in bank 0

0x04

movwf
movlw
movwf

TEMP
3
COUNTER5

begin:
decfsz
goto
goto

COUNTER5

;Temporal storage of the value of w


;Determines how long the interrupt works

start1
stop

start1:
movlw
movwf
call
movlw
movwf
call
goto

b'00010'
PORTA

movlw
movwf

5
COUNTER4

movlw
movwf

5
COUNTER3

movlw
movwf

50
COUNTER2

Delay1
b'00000'
PORTA
Delay1
begin

Delay1:
Loop4:
Loop3:

; PC pointing to interrupt vecto

Loop2:
movlw
movwf

100
COUNTER1

decfsz
goto
decfsz
goto
decfsz
goto
decfsz
goto
return

COUNTER1

movfw
bcf

TEMP

Loop1:
Loop1
COUNTER2
Loop2
COUNTER3
Loop3
COUNTER4
Loop4

stop:
INTCON,1

retfie
; End of interrupt
main
; Setup interrupt registers
bsf
INTCON,7
able (1=enable)
bsf
INTCON,4
enable)
bcf
INTCON,1
Just In Case
bsf
movlw
movwf
movlw
movwf
bcf

;GIE

;INTE - RB0 Interrupt Enable (1=

;Setup the various ports


STATUS,5 ;Switch to Bank 1
0x01
TRISB ;Set RB0 as input
0x10
TRISA ;Set R 0 to RA3 on PortA as output
STATUS,5 ;Come back to Bank 0

start:
movlw
movwf
call
movlw
movwf
call
goto

b'00001'
PORTA

movlw
movwf

5
COUNTER14

movlw
movwf

5
COUNTER13

movlw
movwf

100
COUNTER12

movlw

100

Delay
b'00000'
PORTA
Delay
start

Delay:
Loop44:
Loop33:
Loop22:

Global interrupt en

;INTF - Clear FLag Bit

movwf

COUNTER11

decfsz
goto
decfsz
goto
decfsz
goto
decfsz
goto
return

COUNTER11
Loop11
COUNTER12
Loop22
COUNTER13
Loop33
COUNTER14
Loop44

Loop11:

END

You might also like