Hello Everyone,
I am using timer to create 1sec delay using LPC2138
here is what i am doing
this is my PLL Setup

Here is what i am getting when i'm debugging my code

When I'm trying to simulate in Proteus my led blinks continuously and oscilloscope shows this

can someone please help me with this?
thank you in advance.
I am using timer to create 1sec delay using LPC2138
here is what i am doing
C:
/*
* Project Name: Blink Led Using Timer
* Author: Devjeet Mandal
* MCU used: ARMv7 LPC2138
* CCLK: 60MHz
* PCLK: 12MHz
* PR = [CCLK x Required Time Delay(in sec)] - 1
*/
//include header file for LPC2138(same header file for LPC213 1/2/4/6/8)
#include <LPC213X.h>
#define PRESCALE 60000
void _delay_ms(int ms)
{
T0TCR = 0x02; // Reset Timer
T0TCR = 0x01; // Enable Timer
while (T0TC < ms); // Till TC is less than ms wait. as TC = 1ms
T0TCR = 0x00; // Disable Timer
}
int main(void)
{
T0CTCR = 0x00; //Timer Mode
T0PR = PRESCALE - 1; //Setting the Prescale
T0TCR = 0x02; // Reset Timer
IO0DIR = (1<<0); // LED Pin
while (1)
{
IO0SET |= (1<<0);
_delay_ms(1000);
IO0CLR |= (1<<0);
_delay_ms(1000);
}
}

Here is what i am getting when i'm debugging my code

When I'm trying to simulate in Proteus my led blinks continuously and oscilloscope shows this

can someone please help me with this?
thank you in advance.
Last edited: