All pastes #446278 Raw Edit

Mine

public text v1 · immutable
·published 2007-04-18 11:53 UTC
rendered paste body
include	"p16F877.INC"		;tells the assembler to include another source file

TIMREG	EQU	H'0020'		;tells the assembler that register 20 equals TIMREG
TIMREG1	EQU	H'0021'		;setup new register 21 called timreg1
delval	EQU	H'00ff'	 	;delay time value 255
delval1 EQU	H'00ff'		; "     "     "    "
	
	banksel TRISD		;change register bank
	clrf	PORTD		;make portd an output port
	banksel PORTD		;change back to original bank

start	movlw 	0		;move (mov) into the following literal(l) the value 0 into the w register
	movwf	PORTD		;clear leds on port d
	

	
loop	
	incf	PORTD		;update the 7 segment display from table
	call	delay		;call delay subroutine
	nop			;do nothing for one cycle 
	goto	loop		;go back to instruction before the label loop
	
;
;+++++++++++++++++++++++++++++++++++++++SUBROUTINES+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
;

delay	movlw	delval		;load w with delay value
	movwf	TIMREG		;and put it into register

time	call	delay1		;jump to subroutine delay 2 to further slow leds
	decfsz	TIMREG		;subtract one and skip next instruction if is zero
	goto	time		;go back and call another one off until 0
	return			;return to call point

delay1	movlw	delval1		;load w with delay value
	movwf	TIMREG1		;and put it into register

time1	decfsz	TIMREG1		;subtract one and skip next instruction if is zero
	goto	time1		;go back and call another one off until 0
	return			;return to call point


	end