You are on page 1of 3

PROCESSOR 16F84A

#include "p16f84a.inc"
ERRORLEVEL -224, -302
__CONFIG _CP_OFF & _XT_OSC & _PWRTE_ON & _WDT_OFF
org 0x0
;POJEDNOSTAVLJENO RJEŠENJE
; goto main
;
;
; AdrI equ 10h
; AdrJ equ AdrI + 1
; AdrK equ AdrJ + 1
; I = 0xA2
; J = 0x00
; K = 0x1E
;
;waitX: movlw I
; movwf AdrI
; movlw K
; movwf AdrK
; movlw J
;
;outloop: movwf AdrJ
;
;inloop: decfsz AdrJ, F
; goto inloop
;
; decfsz AdrI, F
; goto outloop
;
;addloop: decfsz AdrK, F
; goto addloop
;
; nop
;
;
; return
;
;main: bsf STATUS, RP0 ;banka 1
; movlw b'00011111'
; movwf TRISA
; movlw b'00000111'
; movwf TRISB
; bcf OPTION_REG, NOT_RBPU
;
; bcf STATUS, RP0 ;banka 0
;
;
; clrf PORTA
; clrf PORTB
;
;
;loop: btfsc PORTB, 2
; goto loop
; goto sw1p
;
;sw1p: btfsc PORTB,0
; goto loop
; goto s1c
;
;s1c: bsf PORTB, 3
; call waitX
; call waitX
; call waitX
; call waitX
; bcf PORTB, 3
;
; goto loop
;
;
; end

goto main

AdrI equ 10h


AdrJ equ AdrI + 1
AdrK equ AdrJ + 1
I = 0xA2
J = 0x00
K = 0x1E

waitX: movlw I
movwf AdrI
movlw K
movwf AdrK
movlw J

outloop: movwf AdrJ

inloop: decfsz AdrJ, F


goto inloop

decfsz AdrI, F
goto outloop

addloop: decfsz AdrK, F


goto addloop

nop

return

main: bsf STATUS, RP0 ;banka 1


movlw b'00011111'
movwf TRISA
movlw b'00000111'
movwf TRISB
bcf OPTION_REG, NOT_RBPU

bcf STATUS, RP0 ;banka 0

clrf PORTA
clrf PORTB
loop: btfsc PORTB, 2
goto loop
goto s1t

s1t: btfsc PORTB,0


goto s2t
goto s12t

s2t: btfsc PORTB, 1


goto loop
goto s12t

s12t: btfsc PORTB, 0


goto s1c
btfsc PORTB, 1
goto s2c
goto s12c

s1c: bsf PORTB, 3


call waitX
call waitX
call waitX
call waitX
bcf PORTB, 3

goto loop

s2c: bsf PORTB, 4


call waitX
call waitX
call waitX
call waitX
bcf PORTB, 4

goto loop

s12c: bsf PORTB, 4


bsf PORTB, 3
call waitX
call waitX
call waitX
call waitX
bcf PORTB, 4
call waitX
call waitX
call waitX
call waitX
bcf PORTB, 3
goto loop

end

You might also like