Thu May 16, 2013 12:25 am
TITLE "Write Count to Port D"
list p = 16f877
include <p16f877.inc>
DELAY_VHI EQU H'30'
DELAY_HI EQU H'31'
DELAY_LO EQU H'32'
COUNT EQU H'33'
ORG H'00'
NOP
GOTO START
ORG 0x20
START BCF STATUS,RP0; BANK 0
CLRF PORTD; INITALIZE PORTC BY CLEARING OUTPUT
DATA LATCHES
BSF STATUS,RP0; SELECT BANK1
MOVLW 0X00;W REG=00
MOVWF TRISD;SET RD AS OUTPUTS
BCF STATUS,RP0; BANK 0
CLRF COUNT; COUNT = 0
MAIN MOVF COUNT,W; GET COUNT
MOVWF PORTD; OUTPUT W REG TO PORTD
CALL DELAY
CALL DELAY
INCF COUNT; COUNT= COUNT+1
GOTO MAIN
; SUBRoUTINES
DELAY
MOVLW 0X01
MOVWF DELAY_LO
MOVLW 0XA1
MOVWF DELAY_HI
MOVLW 0XFF
MOVWF DELAY_VHI
BIG
OUTER
INNER
INCFSZ DELAY_LO,1
GOTO INNER
INCFSZ DELAY_HI,1
GOTO OUTER
INCFSZ DELAY_VHI
GOTO INNER
RETURN
END
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.