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

Hex file bulit by uvision4 not run on real board

Hi all,

I am studying ARM LPC2103 and try a simple delay code with timer 1

#include <lpc210x.h>
void set_up_PLL(void)
{
        PLLCFG=0x00000024;              //xtal=12Mhz, cclk=60Mhz => M=5, P=2
        PLLCON=0x00000003;              //PLL contected, PLL enabled
        PLLFEED=0x000000AA;
        PLLFEED=0x00000055;             //PLL feeded
        VPBDIV=0x000000002;             //pclk=1/2cclk
}
void set_up_timer1(void)
{
        T1CTCR=0x00000000;              //timer1 set as a timer, so T1CTCR[1:0]=00
        T1PR=0x00000009;                //Pclk devided by 10 when using for Timer1
        T1MR0=0x002DC6C0;               //T1MRO=3000000, after rising pulse, PC register increases by 1, when PC register reaches to 9
                                                        //which means that 10 rising pulses executed, PC register will be reset and TC will increase by 1
                                                        //when TC reaches to value in T1MR0=3000000 that means there would have been 30000000 pulses rose by
                                                        //pclk (similar with time of 1 second) there will be a event depending on set up of T1MCR register
        T1MCR=0x00000002;               //the event selected is to reset timer1 so T1MCR[2:0]=0b101;
}
void set_up_outputpin(void)
{
        PINSEL1=0x00000020;             // pin P0.19 is selected as MAT1.2
        T1EMR=0x00000300;               //after timer1 reset, pin MAT1.2 (P0.19) will be reversed bit, so T1EMR[5:4] should be 1:1
}
int main(void)
{
        set_up_PLL();                   //set up PLL so that cclk=60Mhz, pclk=30Mhz
        set_up_timer1();                //set up timer1 as timer to count Pclk rising pulses, after 1s, 1 event will reset timer 1
        set_up_outputpin();             //set up status of output pin when events generated by timer1
        T1TCR=0x00000002;               //reset timer1
        T1TCR=0X00000001;               //enable time1;
        while(1)
        {
        ;
        }

}


I built it without issue but when I run it on real board. It seem nothing executed. I don't know why. I think at least it run wrong result, it not able to do nothing like that.
Please help me solve issue.

Thanks and Best regards,
Nguyen, Uy Danh

Parents Reply Children
No data