Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Thread

Writing to match register while the timer is running

Writing to match register while the timer is running

2004-07-13 by johnthomasedwardtimm

I have created a frequency generator using timer1.  I have had 
problems loading the match register on the fly.  Sometimes I start 
losing interrupts.  I have tried simply disabling the timer when I do 
a reload, but it doesn't seem to help.  What does work is something 
like this:

DWORD dwMatch;

dwMatch = ...;  // calculate new match value

if (dwMatch != T1MR0) {
    T1TCR = 2;       // disable/reset timer1
    T1MR0 = dwMatch; // reload the match register
}

T1TCR = 1;      // enable timer1

The key is the "reset" of timer1 before the reload.  Does anybody 
know why this is the case?  Is there a better way to accomplish this?

Thanks,

JT

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.