| figdungiven 
 
 
 Joined: 30 Mar 2006
 Posts: 1
 
 
 
			    
 
 | 
			
				| Measuring pulse width using TImer 1 |  
				|  Posted: Thu Mar 30, 2006 4:40 am |   |  
				| 
 |  
				| Anyone know code for measuring a pulse from a 555 timer? Any help would be much appreciated?
 Below is the code i have at the minute. I am using PIC 16F874 and programming in C
 
 #include <16f874.h>
 #use delay (clock = 4000000)
 #byte PORTC = 7
 #bit INPUT = PORTC.0
 setup_timer_1(T1_INTERNAL , T1_DIV_BY_1);
 long int PERIOD;
 main()
 {
 set_tris_c (0x01); // setting up ports
 PERIOD= 0;
 while(INPUT==0)
 set_timer1(0);
 while(INPUT==1);
 
 PERIOD = get_timer1();
 |  |