Sie sind auf Seite 1von 4

processor 16f84a

#include "p16f84a.inc"

__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC


J equ H'1F'
K equ H'1E'

org 0x000 ; start at address 0


START

bsf STATUS,RP0 ; Select bank 1


movlw B'00000000' ; w := 00000000 binary
movwf TRISB ; port B data direction := w
movlw B'11111111' ; w := 11111111 binary
movwf TRISA ; port A data direction := w
bcf STATUS,RP0 ; Select Bank 0
loop
movlw 0x00
movwf PORTB

loop2
btfsc PORTA,4
goto loop

movlw b'10000000'
movwf PORTB
call delay

movlw b'01000000'
movwf PORTB
call delay

movlw b'00100000'
movwf PORTB
call delay

movlw b'00010000'
movwf PORTB
call delay

movlw b'00001000'
movwf PORTB
call delay

movlw b'00000100'
movwf PORTB
call delay

movlw b'00000010'
movwf PORTB
call delay

movlw b'00000001'
movwf PORTB
call delay

goto loop3
loop3
btfsc PORTA,4
goto loop

movlw b'00001111'
movwf PORTB
call delay1

movlw b'11110000'
movwf PORTB
call delay1

movlw b'00001111'
movwf PORTB
call delay1

movlw b'11110000'
movwf PORTB
call delay1

goto loop4
loop4
btfsc PORTA,4
goto loop

movlw b'01010101'
movwf PORTB
call delay1

movlw b'10101010'
movwf PORTB
call delay1

movlw b'01010101'
movwf PORTB
call delay1

movlw b'10101010'
movwf PORTB
call delay1

goto loop5
loop5
btfsc PORTA,4
goto loop

movlw b'00000000'
movwf PORTB
call delay1

movlw b'11111111'
movwf PORTB
call delay1

movlw b'00000000'
movwf PORTB
call delay1

movlw b'11111111'
movwf PORTB
call delay1
goto loop6

loop6

btfsc PORTA,4
goto loop

movlw b'10000001'
movwf PORTB
call delay1

movlw b'01000010'
movwf PORTB
call delay1

movlw b'00100100'
movwf PORTB
call delay1

movlw b'00011000'
movwf PORTB
call delay1

movlw b'10000001'
movwf PORTB
call delay1

movlw b'01000010'
movwf PORTB
call delay1

movlw b'00100100'
movwf PORTB
call delay1

movlw b'00011000'
movwf PORTB
call delay1
goto loop7

loop7
btfsc PORTA,4
goto loop

movlw b'00000000'
movwf PORTB
call delay1

movlw b'10000000'
movwf PORTB
call delay1

movlw b'01000000'
movwf PORTB
call delay1

movlw b'11000000'
movwf PORTB
call delay1

movlw b'00100000'
movwf PORTB
call delay1

movlw b'10100000'
movwf PORTB
call delay1

movlw b'01100000'
movwf PORTB
call delay1

movlw b'11100000'
movwf PORTB
call delay1

movlw b'00010000'
movwf PORTB
call delay1

movlw b'10010000'
movwf PORTB
call delay1
goto loop2
delay:
movlw D'3000'
movwf J
delay1:
movlw D'1000'
movwf J
jlp:
movwf K
klp:
decfsz K,f
goto klp
decfsz J,f
goto jlp
return
end

Das könnte Ihnen auch gefallen