  | 
	  | 
		 
	 
	
		| View previous topic :: View next topic   | 
	 
	
	
		| Author | 
		Message | 
	 
	
		
			Guest
 
 
 
 
 
  
			
			
			
			
			
			
			
			
			
			
  
		  | 
		
			
				| Timer0: is my thinking correct?? | 
			 
			
				 Posted: Tue Mar 27, 2007 1:37 pm     | 
				     | 
			 
			
				
  | 
			 
			
				Hi All,
 
 
I am using a 12F629 device with the internal 4 MHz oscillator. With this configuration, I believe that each clock cycle is 1 us, and thus the Timer0 can potentially increment every 4 us (Fosc/4). Is that correct? 
 
 
Then if I further prescale this value by 16, the actual timer increment period  
 
is 64 uS (16 X 4 uS).
 
 
Am I thinking about this correctly, because I'm getting consistently strange results when I try to use Timer0 to measure the duration of a known pulse width.  
 
 
[code}
 
 
	setup_counters( RTCC_INTERNAL, RTCC_DIV_16 );
 
 
[/code]
 
 
Thanks,
 
 
Charles | 
			 
		  | 
	 
	
		  | 
	 
	
		
			PCM programmer
 
 
  Joined: 06 Sep 2003 Posts: 21708
  
			
			 
			 
			
			
			
			
			
			
			
  
		  | 
		
			
				 | 
			 
			
				 Posted: Tue Mar 27, 2007 1:43 pm     | 
				     | 
			 
			
				
  | 
			 
			
				 	  | Quote: | 	 		  
 
I am using a 12F629 device with the internal 4 MHz oscillator. With this
 
configuration, I believe that each clock cycle is 1 us, and thus the
 
Timer0 can potentially increment every 4 us (Fosc/4). Is that correct?  | 	  
 
The oscillator freq is 4 MHz, so the oscillator period is 250 ns.
 
 
The instruction cycle clock is 1/4 of the oscillator freq.   Therefore 
 
it's 1 MHz, and the instruction cycle clock period is 1 us.
 
    
 
The timers run off the instruction cycle clock. | 
			 
		  | 
	 
	
		  | 
	 
	
		 | 
	 
 
  
	 
	    
	   | 
	
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
  | 
   
 
  
Powered by phpBB © 2001, 2005 phpBB Group
  
		 |