C:\Users\farahman\Desktop\es310_lab_X\MPLABX Examples\simple Assembly\first_blinking_LED.X\input_switch.asm |
53 ;//** I N I T I A L I Z A T I O N ***********/ 54 55 ;//** Constants 56 Inner_loop equ D'166' 57 Outer_loop equ D'0' 58 59 ;//** Register Declaration: 60 reg1 equ 0x01 61 reg10 equ 0x10 62 reg11 equ 0x11 63 64 ;//** M A I N C O D E ***********/ 65 org 0x20 66 start1 67 movlw B'00000000' ; Initialization 68 movwf TRISD 69 movlw B'11110000' 70 movwf TRISB 71 clrf PORTB 72 clrf PORTD 73 check 74 btfss PORTB,5 ; Check to see if bit 5 is SET 75 btg PORTD,7 ; If SET then skip this - no blinking 76 call delay ; if not set then blink LED 77 goto check 78 79 delay ; Delay Subroutine 80 movlw Inner_loop 81 movwf reg10 82 83 movlw Outer_loop 84 movwf reg11 85 86 loop1 87 decf reg10,1 88 bnz loop1 89 decf reg11,1 90 bnz loop1 91 return 92 93 end