Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ORG 0
  2.  
  3.     LCALL init_timer
  4.     SJMP $ 
  5.  
  6. ORG 0Bh
  7.     MOV TH0, #60
  8.     MOV TL0, #150
  9.     CPL P1.4
  10.     RETI
  11.  
  12. init_timer:
  13.     CLR TR0
  14.     MOV TMOD, #01
  15.     MOV TH0, #60
  16.     MOV TL0, #150
  17.     CLR TF0
  18.  
  19.     SETB ET0
  20.     SETB EA
  21.  
  22.     SETB TR0
  23.     RET
  24.  
  25. ;----------------------------------------
  26. test_delay:
  27.     CLR P1.5
  28.     MOV R7, #20
  29.     ;LCALL odmierz_x50ms_int
  30.  
  31.     SETB P1.5
  32.     MOV R7, #10
  33.     ;LCALL odmierz_x50ms_int
  34.     SJMP    test_delay
  35.  
  36. ;----------------------------------------
  37. ; Opoznienie R7 x 50 ms
  38. ;----------------------------------------
  39. odmierz_x50ms:
  40.     CLR TR0
  41.     MOV TMOD, #01
  42. odmierz_x50ms_petla:
  43.     MOV TH0, #60
  44.     MOV TL0, #150
  45.     CLR TF0
  46.     SETB TR0
  47.     JNB  TF0, $
  48.     DJNZ R7, odmierz_x50ms_petla
  49.     RET
  50.  
  51. END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement