Advertisement
Guest User

Untitled

a guest
Jun 16th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pic 16 0.88 KB | None | 0 0
  1. ; ---- main
  2.         ORG         0x0000
  3.         CALL        Init
  4.  
  5. LoopDeLoop
  6. ; ---- loop with 1
  7.         BSF         PORTD,      0   ;   set D0
  8.         CALL        ResTimerTenMs   ;   reset & init timer
  9.         BSF         T1CON,      0   ;   start timer
  10. LoopHurr
  11.         BTFSS       PIR1,       0   ;   wait for interruptflag
  12.         GOTO        LoopHurr
  13.  
  14. ; ---- loop with 0
  15.         BCF         PORTD,      0   ;   clear D0
  16.         CALL        ResTimerTenMs   ;   reset & init timer
  17.         BSF         T1CON,      0   ;   start timer
  18. LoopDurr
  19.         BTFSS       PIR1,       0   ;   wait for interruptflag
  20.         GOTO        LoopDurr
  21.  
  22.  
  23.         GOTO        LoopDeLoop      ;   go to start
  24.  
  25.  
  26. ; --- timer init and reset subroutine
  27. ResTimerTenMs
  28.         BCF         T1CON,      0   ;   stop timer
  29.         BCF         PIR1,       0   ;   reset interruptflag
  30.         MOVWF       0xD8            ;   set timer to 0xFFFF-D'10000'
  31.         MOVLW       TMR1H
  32.         MOVWF       0xEF
  33.         MOVLW       TMR1L
  34.         RETURN
  35.  
  36. ; --- Initialization subroutine
  37. Init
  38.         BANKSEL     TRISD
  39.         MOVLW       B'11111110'
  40.         MOVWF       TRISD
  41.         BANKSEL     T1CON
  42.         ;MOVLW      B'00000000'
  43.         ;MOVWF      T1CON
  44.         RETURN
  45.  
  46.         END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement