; ECE 376 Lecture #4: Binary Inputs ; Up Counter #include COUNT equ 0 org 0x800 movlw 0xFF movwf TRISB clrf TRISD movlw 0x0F movwf ADCON1 clrf COUNT clrf PORTD ; while(RB0 == 1); L1: btfsc PORTB,0 goto L1 ; while(RB0 == 0); L2: btfss PORTB,0 goto L2 ; Rising edge detected ; PORTD = PORTD + 1; incf COUNT,F movff COUNT, PORTD goto L1 end