:: مهندس ::
تاريخ التسجيل: Mar 2007
المشاركات: 4
|
|
نشاط [ ali237 ]
قوة السمعة:0
|
|
06-01-2008, 04:17 PM
المشاركة 1
|
|
السلام عليكم
ممكن أحد أخوان شرح هذه البرمجه كل بارت وطريقة شتغاله .
include <p16f628.inc>
COUNT1 equ H'20' ;
COUNT2 equ H'21' ;
COUNT3 equ H'22' ;
COUNT4 equ H'23' ;
T1R equ 0 ;
T1Y equ 1 ;
T1G equ 2 ;
T2R equ 3 ;
T2Y equ 4 ;
T2G equ 5 ;
bsf STATUS,RP0
clrf TRISB
bcf STATUS,RP0
clrf PORTB
bsf PORTB,T1R
bsf PORTB,T2R
Start
call Delay2
call T1ON
call Delay10
call T1OFF
call Delay2
call T2ON
call Delay10
call T2OFF
goto Start
T1ON
bsf PORTB,T1Y
call Delay2
bcf PORTB,T1R
bcf PORTB,T1Y
bsf PORTB,T1G
return
T1OFF
bcf PORTB,T1G
bsf PORTB,T1Y
call Delay2
bcf PORTB,T1Y
bsf PORTB,T1R
return
T2ON
bsf PORTB,T2Y
call Delay2
bcf PORTB,T2R
bcf PORTB,T2Y
bsf PORTB,T2G
return
T2OFF
bcf PORTB,T2G
bsf PORTB,T2Y
call Delay2
bcf PORTB,T2Y
bsf PORTB,T2R
return
Delay2
call Delay
call Delay
return
Delay10
movlw d'10'
movwf COUNT4
Loop10 call Delay
decfsz COUNT4
goto Loop10
return
Delay ;a delay subroutine of around 1 sec.
movlw d'239'
movwf COUNT3
Loop3 movlw d'76'
movwf COUNT2
Loop2 movlw d'17'
movwf COUNT1
Loop1 decfsz COUNT1
goto Loop1
decfsz COUNT2
goto Loop2
decfsz COUNT3
goto Loop3
movlw d'6'
movwf COUNT1
Loop4 decfsz COUNT1
goto Loop4
return
end ;End of the program
|