Advertisement
ango

TMR2_TIME_CYCLE_UNCOMMENTED

May 31st, 2012
2,506
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pic 16 1.01 KB | None | 0 0
  1. poc1 equ 21h
  2. poc2 equ 22h
  3.  
  4.   org   00h          
  5.   goto start        
  6.  
  7.   org 04h          
  8.   bcf   PIR1,TMR2IF
  9.   decf poc1,1      
  10.   btfsc STATUS,2     
  11.   call sem1        
  12.  
  13.   comf  PORTB,1    
  14.   retfie          
  15.  
  16. start:
  17.    bsf STATUS,RP0  
  18.    clrf ANSEL      
  19.    movlw 60h        
  20.    movwf OSCCON    
  21.    
  22.    clrf TRISB      
  23.    
  24.    ;x= ((fosc/4)/f)/(PRESC*POSTSC))-1
  25.    
  26.    movlw .x        
  27.    movwf PR2      
  28.    movlw 02h      
  29.    movwf PIE1      
  30.    
  31.    bcf   STATUS,RP0
  32.    clrf PORTB      
  33.    
  34.    movlw .y         ; y je kolikrat to prevrati hranu nez to prerusim
  35.    movwf poc1      
  36.    
  37.    movlw z          ; z je nastaveni T2CON coz sou preddelicky a postdelicky atd.
  38.    movwf T2CON      
  39.    
  40.    movlw 0C0      
  41.    movwf INTCON    
  42.    bsf T2CON,TMR2ON
  43.    
  44. Sem1              
  45.    nop            
  46.    Sem2            
  47.    decf poc2,1      
  48.    btfss STATUS,2  
  49.    goto Sem2        
  50.    return        
  51.     end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement