Quoting gvnn77 <paynet@...>: > where L_COMPAREMATCH is equal to 6000. Doing so, our next tick is > after 71 seconds (that is about 0xFFFFFFFF clock at 60MHz) > If I substitute previous code with: > > T0MR0 = T0TC + L_COMPAREMATCH; > > our next tick is about after 100 microseconds. > But I cannot use this code, as I will lost tick between match on > T0MR0-T0TC and recalculation-setting of next compare. > > How can I do? I cannot use Timer1 for O.S. tick as it is used for > other purposes... > Is it possible that between match on Compare0 and write of next > Compare0, T0TC counts as many ticks as my match value? I tried to > increment tick value of compare, but nothing, it doesn't work! My > LPC works at 60MHz as Timer0, so I don't think that it executes about > 20 instructions (corresponding to flag check and T0MR0 += > L_COMPAREMATCH;) in 100 microseconds!!!! Depending on what else you are doing you may be surprised. Divides are a particular issue. Take a look at the timer performance application note at http://www.aeolusdevelopment.com/Articles/docandapp.html It goes through some of the things I did to get preditable performance and what the barriers to high speed timing were. It would be very worthwhile to measure how long both of your routines are actually taking. Note that I/O takes multiple cycles. Robert
Message
Re: [lpc2000] Multiple compare and capture on same Timer
2006-02-20 by Robert Adsett
Attachments
- No local attachments were found for this message.