программа

Download программа

If you can't read please download the document

Upload: gt

Post on 17-Nov-2015

220 views

Category:

Documents


0 download

DESCRIPTION

fgf

TRANSCRIPT

;***********************************************************************************************;*************************** ************************************;***********************************************************************************************;===============================================================================================; PIC16F84A. 4000.;********************************************************************************************* LIST p=16F84a ; PIC16F84A. __CONFIG b'11111001' ; WDT , .;===============================================================================================; . ;===============================================================================================Indf equ 00h ; Indf OptionR equ 01h ; Option - 1Pcl equ 02h ; 8 PcStatus equ 03h ; StatusFsr equ 04h ; FsrPortA equ 05h ; ATrisA equ 05h ; Tris A - 1PortB equ 06h ; BTrisB equ 06h ; Tris B - 1Eedata equ 08h ; - EEPROMEecon1 equ 08h ; - EEPROMEeadr equ 09h ; - EEPROMEecon2 equ 09h ; - EEPROMPclath equ 0Ah ; 8 PcIntCon equ 0Bh ; IntConIntcon equ 0Bh ; Intcon.;===============================================================================================; .;===============================================================================================Registr equ 0Ch ; , EEPCicle equ 0Dh ;Temp equ 0Eh ;Adrr equ 0Fh ;Delay equ 10h ;Delay1 equ 11h ; Delay2 equ 13h ;BLOCK_ equ 14h ; 0 "1", Label9 equ 15h ;Label10 equ 16h ; Label11 equ 17h ;Label12 equ 18h ;Label13 equ 19h ;Label14 equ 1Ah ;Label15 equ 1Bh ; Label16 equ 1Ch ;Label17 equ 1Dh ;Label18 equ 1Eh ;Label19 equ 1Fh ;;===============================================================================================; .;===============================================================================================W equ 0 ; .F equ 1 ; .;===============================================================================================; .;===============================================================================================RP0 equ 5 ; .GIE equ 7 ; .OPEN_FLEFT equ 0 ; .//OPEN_FRIGHT equ 1 ; .//OPEN_TLEFT equ 2 ; .//OPEN_TRIGHT equ 3 ; .//CLOSE_FLEFT equ 4 ; .//CLOSE_FRIGHT equ 5 ; .//CLOSE_TLEFT equ 6 ; .//CLOSE_TRIGHT equ 7 ; .//OPEN equ 0 ; CLOSE equ 1 ; BLOCK equ 2 ; NO_BLOCK equ 3 ; ("0"- );=============================================================================================== org 0 ; goto START ; START.;***********************************************************************************************;***********************************************************************************************; ;***********************************************************************************************START clrf IntCon ; . bsf Status,RP0 ; 1. movlw 0Fh ; RA0, RA1, RA2,RA4 movwf TrisA ; movlw 0h ; PortB movwf TrisB BCF OptionR ,7 ; '0' OptionR. bcf Status,RP0 ; 0. BCF BLOCK_,0 ; '0' BLOCK_ movlw b'00000000' ; RA0, RA1, RA2,RA4 '1' movwf PortB ; clrw;***********************************************************************************************; ;***********************************************************************************************PROV BTFSS PortA,BLOCK ; / " "/ BSF BLOCK_,0 ; '1' BLOCK_ BTFSC PortA,OPEN ; / ""/ GOTO OPEN_DORS BTFSC PortA,CLOSE ; / ""/ GOTO CLOSE_DORS GOTO START ;***********************************************************************************************; ;***********************************************************************************************CLOSE_DORS BTFSS PortA,NO_BLOCK ; /- GOTO START CALL Pause BTFSS PortA,CLOSE ; GOTO START ; BTFSC BLOCK_,0 ; , ; Goto NEXT BSF PortB,CLOSE_TRIGHT ; CALL Pause ; 0.7 BCF PortB,CLOSE_TRIGHT BSF PortB,CLOSE_TLEFT ; CALL Pause ; 0.7 BCF PortB,CLOSE_TLEFT NEXT BSF PortB,CLOSE_FRIGHT ; CALL Pause ; 0.7 BCF PortB,CLOSE_FRIGHT BSF PortB,CLOSE_FLEFT ; CALL Pause ; 0.7 BCF PortB,CLOSE_FLEFT GOTO START ;***********************************************************************************************; ;***********************************************************************************************OPEN_DORS CALL Pause BTFSS PortA,OPEN ; GOTO START BTFSC BLOCK_,0 ; / " GOTO NEXT2 BSF PortB,OPEN_TRIGHT ; CALL Pause ; 0.7 BCF PortB,OPEN_TRIGHT BSF PortB,OPEN_TLEFT ; CALL Pause ; 0.7 BCF PortB,OPEN_TLEFT NEXT2 BSF PortB,OPEN_FRIGHT ; CALL Pause ; 0.7 BCF PortB,OPEN_FRIGHT BSF PortB,OPEN_FLEFT ; CALL Pause ; 0.7 BCF PortB,OPEN_FLEFT GOTO START ;***********************************************************************************************;delay = 0.7 ;***********************************************************************************************Pause ;RETURN movlw .18 movwf Delay movlw .142 movwf Delay1 movlw .4 movwf Delay2wr decfsz Delay, F goto wr decfsz Delay1, F goto wr decfsz Delay2, F goto wr nop RETURN;*********************************************************************************************** end ; .