LPC2148 timer0 not working as expected

I am new to ARM and I am trying to produce 1 second delay using timer 0 in LPC2148. But in debug session in Keil, it is giving delay of 4 seconds with 15MHz and 5 seconds with 12 MHz. What is the issue ?

Here is my code.

#include <lpc214x.h>
int main()
    IODIR0 = 1; // P0.0 is output pin
    IOSET0 = 1; // P0.0 is high
    T0PR = 15000000 - 1;
    T0TC = T0PC = 0;
    T0TCR = 1;  // start
    do {
        while(T0TC == 0);
        T0TC = 0;
        IOCLR0 = 1; // P0.0 is low
        while(T0TC == 0);
        T0TC = 0;
        IOSET0 = 1; // P0.0 is high
    } while(1);

Parents Reply
  • ARM simply license the designs of CPU cores to chipmakers

    These designs are commonly known as "Intellectual Property" - or "IP" for short.
    (not to be confused with "IP" for "Internet Protocol").


    ARM do also license other types of IP besides just the CPU cores.

    The chipmakers incorporate ARM's CPU design into their microcontrollers,  along with other components of their own, proprietary, design - such as Timers, IO, etc

    These other designs are also commonly referred to as "IP".

    This is the IP which distinguishes one manufacturer's ARM-based microcontroller from  another manufacturer's microcontroller based on the same ARM core.

    You will often find that manufacturers re-use such IP across multiple products.

No data
More questions in this forum