Thu May 16, 2013 3:41 pm
TITLE "Write DAC"
liat p = 16f877
include <pl6f877.inc>
DELAY_LO EQU H'30'
COUNT EQU H'32'
ORG H'00'
NOP
GOTO START
;THE ROUTINES START HERE
ORG 0x20
START BCF STATUS,RP0 ;BANK 0
CLRF PORTD ;-INITIALIZE PORTC By CLEARING OUTPJT 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 PORTB
CALL DELAY
CALL DELAY
INCF COUNT ;COUNT = COUNT + 1
GOTO MAIN
;SUBROUTINES
DELAY
MOVLW 0X01; SET DELAY TIME
MOVWF DELAY_LO
WAIT
INCFSZ DELAY_LO,1; COUNT DOWN
GOTO WAIT
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.