Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. #include p16f84a.inc
  2. input_buffer equ 0x10
  3. loop_index equ 0x11
  4. input_ports_count set 0x7
  5. first_segment_bit set 0x3
  6. secont_segment_bit set 0x4
  7. input_port set 0x2
  8. shift_register_reset_bit set 0x0
  9. shift_register_clock_bit set 0x1
  10.  
  11. org 0x0
  12. goto START
  13.  
  14. PGM code
  15.  
  16. START
  17. movlw 0x3
  18. movwf PORTA
  19. clrf PORTB
  20.  
  21. bsf STATUS, RP0
  22. clrf TRISA
  23. bsf TRISA, input_port
  24. clrf TRISB
  25. bcf STATUS, RP0
  26. LISTNER_LOOP:
  27. movlw input_ports_count
  28. movwf loop_index
  29. clrf input_buffer
  30.  
  31. bcf PORTA, shift_register_reset_bit
  32. bsf PORTA, shift_register_reset_bit
  33. bsf PORTA, first_segment_bit
  34. bsf PORTA, secont_segment_bit
  35.  
  36. btfss PORTA, input_port
  37. goto SET_SECOND_SEGMENT
  38. SET_FIRST_SEGMENT:
  39. bcf PORTA, first_segment_bit
  40. goto INPUT_LOOP
  41. SET_SECOND_SEGMENT:
  42. bcf PORTA, secont_segment_bit
  43. INPUT_LOOP:
  44. bcf PORTA, shift_register_clock_bit
  45. bsf PORTA, shift_register_clock_bit
  46.  
  47. rlf input_buffer
  48. btfsc PORTA, input_port
  49. bsf input_buffer, 0
  50.  
  51. decfsz loop_index, 1
  52. goto INPUT_LOOP
  53.  
  54. movf input_buffer, 0
  55. movwf PORTB
  56. goto LISTNER_LOOP
  57. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement