Using external clock for 16 bit counter in Atmega 8

Status
Not open for further replies.

alfie.max15

Member level 2
Joined
Jan 3, 2013
Messages
47
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Visit site
Activity points
1,660
I am using Atmega 8 16 bit counter.
It works fine with the internal clock.
But when tryin to use a signal as external clock on T1 pin on the uC the pin stays high all the time.



Code C - [expand]
1
2
3
4
5
6
7
DDRD &= ~(1 << DDD5);     // Clear the PD5 pin      
   // PD5 is now an input 
    
   PORTD |= (1 << PORTD5);   // turn On the Pull-up      
   // PD5 is now an input with pull-up enabled 
    
   TCCR1B |= (1 << CS12) | (1 << CS11) | (1 << CS10);     // Turn on the counter, Clock on Rise



I used the above code so as to use the external clock on pin T1
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…