Beruflich Dokumente
Kultur Dokumente
#include <p16F84A.inc>
; VARIABLE DEFINITIONS
; Start Place
;**********************************************************************
;SubRoutine
;***
;***
END
LIST P=16f84
;----------------------------------------------------------------------------
-----------------------
banksel TRISA ; Moving from 'Bank 0' to 'Bank 1'.
movlw b'00000' ; Move adress 00000 to 'w' register .
movwf TRISA ; move value of W into TRISA. It designate all bit
output
;----------------------------------------------------------------------------
-----------------------
start
movlw b'00000001' ; load W to turn on Porta, bit 0
movwf PORTA ; Move value in W to POORTA to turn on led on RA0
;----------------------------------------------------------------------------
-----------------------
;4999993 cycles
Delay5SEC movlw 0x2C
movwf d1
movlw 0xE7
movwf d2
movlw 0x0B
movwf d3
Delay_0
decfsz d1, f
goto $+2
decfsz d2, f
goto $+2
decfsz d3, f
goto Delay_0
;3 cycles
goto $+1
nop
end
LIST P=16f84
#INCLUDE"P16f84.INC"
;----------------------------------------------------------------------------
-----------------------
;EQUATES
cblock 0x0c
d1
d2
d3
endc
;----------------------------------------------------------------------------
-----------------------
bsf 03h,5 ; Moving from 'Bank 0' to 'Bank 1'.
movlw b'00000' ; Move adress 00000 to 'w' register .
movwf 85h ; move value of W into TRISA. It designate all bits
as
;output
call Delay
; call Delay_0 ; call delay function.
;----------------------------------------------------------------------------
-----------------------
;4999993 cycles
Delay movlw 0x2C
movwf d1
movlw 0xE7
movwf d2
movlw 0x0B
movwf d3
Delay_0
decfsz d1, f
goto $+2
decfsz d2, f
goto $+2
decfsz d3, f
goto Delay_0
;3 cycles
goto $+1
nop
;EQUATES
;----------------------------------------------------------------------------------
-----------------
start
movlw b'00001' ; means 2 in decimal, 00010 in decimal. logic 1 to 2nd bit.
movwf 05h ; move logic 1 to 2nd Bit of PORTA. It let to on LED connected to 2nd bit
i.s A1.
call Delay
call Delay_0 ; call delay function.
;----------------------------------------------------------------------------------
-----------------
;4999993 cycles
Delay movlw 0x2C
movwf d1
movlw 0xE7
movwf d2
movlw 0x0B
movwf d3
Delay_0
decfsz d1, f
goto $+2
decfsz d2, f
goto $+2
decfsz d3, f
goto Delay_0
;3 cycles
goto $+1
nop