Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for 8A #4

Open
curlyz opened this issue Jul 10, 2017 · 0 comments
Open

Add support for 8A #4

curlyz opened this issue Jul 10, 2017 · 0 comments

Comments

@curlyz
Copy link

curlyz commented Jul 10, 2017

Replace this

TIMSK2 = 0; // disable interrupts TCCR2A = 0; // normal counting mode TCCR2B = _BV(CS21); // set prescaler of 8 TCNT2 = 0; // clear the timer2 count TIFR2 = _BV(TOV2); // clear pending interrupts; TIMSK2 = _BV(TOIE2) ; // enable the overflow interrupt

With this
`#if defined (AVR_ATmega8) || defined (AVR_ATmega8A)

TIMSK = 0;  // disable interrupts 
bitClear(TCCR2,WGM20);
bitClear(TCCR2,WGM21);
TCCR2 = _BV(CS21);
TCNT2 = 0;      // clear the timer2 count 
TIFR = _BV(TOV2);
TIMSK =  _BV(TOIE2) ; // enable the overflow interrupt	  

#else
TIMSK2 = 0; // disable interrupts
TCCR2A = 0; // normal counting mode
TCCR2B = _BV(CS21); // set prescaler of 8
TCNT2 = 0; // clear the timer2 count
TIFR2 = _BV(TOV2); // clear pending interrupts;
TIMSK2 = _BV(TOIE2) ; // enable the overflow interrupt
#endif
`
This is a noob code :) It will need a proper coding

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant