| View previous topic :: View next topic   | 
	
	
	
		| Author | 
		Message | 
	
	
		
			holy Guest
 
 
 
 
  
			
			
			
			
			
			
			
			
			
			
  
		  | 
		
			
				| timer0 in INT_EXT | 
			 
			
				 Posted: Sun Oct 31, 2004 7:11 pm     | 
				     | 
			 
			
				
  | 
			 
			
				I use timer0 and int_ext 
 
why in my int_ext interrupt  timer0 interrupt is disabled? | 
			 
		  | 
	
	
		  | 
	
	
		
			Haplo
 
 
  Joined: 06 Sep 2003 Posts: 659 Location: Sydney, Australia 
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Sun Oct 31, 2004 7:16 pm     | 
				     | 
			 
			
				
  | 
			 
			
				What PIC are you using?
 
In PIC16s you can not have interrupts inside other interrupts. The first thing the interrupt dispatcher does is to diable all the interrupts before entering the ISR.
 
 
Quoting from PIC16F877 datasheet:
 
 
 	  | Quote: | 	 		  When an interrupt is responded to, the GIE bit is
 
cleared to disable any further interrupt, the return
 
address is pushed onto the stack and the PC is loaded
 
with 0004h. | 	 
  | 
			 
		  | 
	
	
		  | 
	
	
		
			holy Guest
 
 
 
 
  
			
			
			
			
			
			
			
			
			
			
  
		  | 
		
			
				| I | 
			 
			
				 Posted: Mon Nov 01, 2004 9:17 am     | 
				     | 
			 
			
				
  | 
			 
			
				I use PIC18F4320 
 
 
INT_RTCC (function1) 10ms
 
INT_EXT  ( call delay 1s, when delay 1s need to function1
 
 
Can I do So? | 
			 
		  | 
	
	
		  | 
	
	
		
			Haplo
 
 
  Joined: 06 Sep 2003 Posts: 659 Location: Sydney, Australia 
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Mon Nov 01, 2004 3:58 pm     | 
				     | 
			 
			
				
  | 
			 
			
				You'd have to make the RTCC interrupt high priority by using the keyword 'fast'. From the manual:
 
 
 	  | Quote: | 	 		  #INT_xxxx fast
 
 
The keyword FAST may be used with the PCH compiler to mark an interrupt high priority.  A fast interrupt can interrupt another interrupt handler.  The compiler does no save/restore in a fast ISR.  You should do as little as possible and save any registers that need to be saved on your own. | 	  
 
 
 
By the way, avoid using delays in ISRs. | 
			 
		  | 
	
	
		  | 
	
	
		 |