;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Source File: lab 01 _4.ASM ; Author: Maher al omari ; Date: oct 13 2023 ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PROCESSOR 16F877a; Define MCU type ;__CONFIG 0x3733 ; Set config fuses ; Register Label Equates.................................... status EQU 03; PORTB EQU 06 ; Port B Data Register TRISB EQU 86 ; Port B Direction Register Timer EQU 20 ; GPR used as delay counter COUNTER EQU 21 ; temp1 EQU 22 ; temp2 EQU 23 ; ; Input Bit Label Equates .................................. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Initialise Port B (Port A defaults to inputs)............. BANKSEL TRISB ; Select bank 1 MOVLW b'00000000' ; Port B Direction Code MOVWF TRISB ; Load the DDR code into F86 BANKSEL PORTB ; Select bank 0 GOTO reset ; Jump to main loop ; 'delay' subroutine ........................................ delay clrf Timer MOVWF Timer ; Copy W to timer register down DECFSZ Timer ; Decrement timer register GOTO down ; and repeat until zero RETURN ; Jump back to main program ; Start main loop ........................................... reset: movlw 0X0A movwf COUNTER Clrf temp2 movf temp1,0 Loop: clrwdt addwf temp1,1; btfsc status,0; incf temp2 CALL delay decfsz COUNTER, 1 goto Loop _______________________ END ; Terminate source code