Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;setup
- bsf status,5
- bcf status,6
- ; set PORTB as output
- clrf trisb
- ; set PORTC bit 0-3 as output
- ; set PORTC bit 4-7 as input
- movlw 0xF0
- movwf trisc
- ; switch to FSR Bank 0
- bcf status,5
- ;end
- chk:
- ; enable PORTC bit 0
- bsf portc,0
- bcf portc,1
- bcf portc,2
- ; check input
- btfsc portc,4
- goto num1
- btfsc portc,5
- goto num2
- btfsc portc,6
- goto num3
- btfsc portc,7
- goto num4
- ; enable PORTC bit 1
- bcf portc,0
- bsf portc,1
- bcf portc,2
- ; check input
- btfsc portc,4
- goto num5
- btfsc portc,5
- goto num6
- btfsc portc,6
- goto num7
- btfsc portc,7
- goto num8
- ; enable PORTC bit 2
- bcf portc,0
- bcf portc,1
- bsf portc,2
- ; check input
- btfsc portc,4
- goto num9
- btfsc portc,5
- goto num0
- goto chk
- num1:
- movlw 0b00000110
- movwf portb
- goto chk
- num2:
- movlw 0b01011011
- movwf portb
- goto chk
- num3:
- movlw 0b01001111
- movwf portb
- goto chk
- num4:
- movlw 0b01100110
- movwf portb
- goto chk
- num5:
- movlw 0b01101101
- movwf portb
- goto chk
- num6:
- movlw 0b01111101
- movwf portb
- goto chk
- num7:
- movlw 0b00000111
- movwf portb
- goto chk
- num8:
- movlw 0b01111111
- movwf portb
- goto chk
- num9:
- movlw 0b01101111
- movwf portb
- goto chk
- num0:
- movlw 0b00111111
- movwf portb
- goto chk
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement