View Single Post
  #7   Spotlight this post!  
Unread 15-03-2004, 16:10
Random Dude Random Dude is offline
Oregon State Head FTA
AKA: Chris
no team (Oregon Robotics Tournament & Outreach Program)
 
Join Date: Aug 2002
Rookie Year: 1998
Location: Oregon
Posts: 142
Random Dude will become famous soon enoughRandom Dude will become famous soon enough
Re: Timer interrupt hic-cupping - HELP

Quote:
Originally Posted by Mark McLeod
I agree with Jamie, this printf will return bogus results. It only processes 16 bits and treats them as a signed int.

No, the %lx directive supports longs.




Though, as to the orignial question, I think it may be a critical section problem, where the interrupt code is running during a critical part of the main code. Specifically:

ThisTick=tmsClock;

That line actually compiles to about 10 lines of assembly. If the interrupt occurs during that section, really odd things can happen. You may need to disable interrupts right before that, and reenable them right after it.

[edit] Further thought on this (and clarification as to the actual problem) makes me realize that this wouldn't occur quite that often.[/edit

Last edited by Random Dude : 15-03-2004 at 17:52.