;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Source File:lab 02 _lookup-table.ASM ; Author: Maher al omari ; Date: March 8 2024 ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; PROCESSOR 16F877a; Define MCU type ;__CONFIG 0x3733 ; Set config fuses ; Register Label Equates.................................... PCL EQU 02; 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 pointer EQU 21 ; ; 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 ; 'table' subroutine ........................................ table: addwf PCL; RETLW 19; RETLW 27; retlw 34; retlw 48; retlw 54; ; '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: clrf pointer; loop: movf pointer,0; call table; movwf PORTB; call delay; incf pointer,1; btfss pointer,2; goto loop; goto $; _______________________ END ; Terminate source code