This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Counter not resetting to 0

I have an LPC24 board and I'm struggling to get the counter to reset to 0.

        int countval;
        T1TCR = 0x02; /*Counter Reset*/
        T1TCR = 0x01; /*Counter Enable*/
        T1CTCR = 0x05; /*Count Pulses*/
        countval = T1TC;
        simplePrintf("%d", countval); /*Print to Display*/

It counts the pulses on the pin fine however the count always seem to start from either 7 or 14 depending on where I place the counter setup code.

Any help would be appreciated.