View Single Post
Old 05-22-2008, 01:41 PM   #130 (permalink)
Yoshi
SuperMID designer
 
Yoshi's Avatar
 
Join Date: Mar 2008
Location: Yokohama, JAPAN
Posts: 37
Thanks: 0
Thanked 13 Times in 2 Posts
Quote:
Originally Posted by dcb View Post
2. go for more accuracy on the instant display:
Why don't you try cli() and sei() routine?
Such as...
Code:
unsigned long microSeconds (void){ 
  unsigned long tmp_timer0_overflow_count;
  byte tmp_tcnt0;
  cli(); //disable interrupts
  tmp_timer0_overflow_count = timer0_overflow_count;
  tmp_tcnt0 = TCNT0;
  sei(); // enable interrupts
  return ((tmp_timer0_overflow_count << 8) + tmp_tcnt0) * 4; 
}
Please let me know if the syntax is wrong.
Quote:
Lets hear from y'all. I'm gonna take a few days off in the mean time.
Have a nice off.

Yoshi
  Reply With Quote