Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include p16f84a.inc
- input_buffer equ 0x10
- loop_index equ 0x11
- input_ports_count set 0x7
- first_segment_bit set 0x3
- secont_segment_bit set 0x4
- input_port set 0x2
- shift_register_reset_bit set 0x0
- shift_register_clock_bit set 0x1
- org 0x0
- goto START
- PGM code
- START
- movlw 0x3
- movwf PORTA
- clrf PORTB
- bsf STATUS, RP0
- clrf TRISA
- bsf TRISA, input_port
- clrf TRISB
- bcf STATUS, RP0
- LISTNER_LOOP:
- movlw input_ports_count
- movwf loop_index
- clrf input_buffer
- bcf PORTA, shift_register_reset_bit
- bsf PORTA, shift_register_reset_bit
- bsf PORTA, first_segment_bit
- bsf PORTA, secont_segment_bit
- btfss PORTA, input_port
- goto SET_SECOND_SEGMENT
- SET_FIRST_SEGMENT:
- bcf PORTA, first_segment_bit
- goto INPUT_LOOP
- SET_SECOND_SEGMENT:
- bcf PORTA, secont_segment_bit
- INPUT_LOOP:
- bcf PORTA, shift_register_clock_bit
- bsf PORTA, shift_register_clock_bit
- rlf input_buffer
- btfsc PORTA, input_port
- bsf input_buffer, 0
- decfsz loop_index, 1
- goto INPUT_LOOP
- movf input_buffer, 0
- movwf PORTB
- goto LISTNER_LOOP
- END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement