Advertisement
Guest User

Untitled

a guest
Dec 13th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. $mod52
  2.  
  3. JMP start
  4.  
  5. org 03h ;INT0 interruption
  6. LJMP i0int
  7.  
  8. org 0Bh ;Timer0 Interrupt
  9. LJMP t0int
  10.  
  11. org 015h
  12. start:
  13. ;Setting default positions
  14. MOV A, #0Fh
  15. MOV R0, #24
  16. MOV P1, A
  17.  
  18. ;Setting interruption modes
  19. SETB EA ;enable all
  20. SETB ET0 ;enable timer 0 int
  21. SETB EX0 ;enable int0 int
  22. SETB IE0 ;set IE0 to 1 = no interupt right now
  23.  
  24. ;Setting timer0 up
  25. MOV TH0, #0h ;set timer high to 0
  26. MOV TL0, #0h ;set timer low to 0
  27. MOV TMOD, #0Ah ;run timer in 1 byte mode
  28. SETB TR0 ;run timer
  29. finish:
  30. JMP finish
  31.  
  32. ;Timer0 interruption procedure
  33. t0int:
  34. DJNZ R0, intEnd
  35. MOV R0, #24
  36. RR A
  37. MOV P1, A
  38. intEnd:
  39. RETI
  40.  
  41. ;INT0 interruption
  42. i0int:
  43. MOV P1, #055h
  44. RETI
  45.  
  46. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement