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

Not working

in the simulation program running smoothly, but when the diwnload to the target is not working as it should. .

The following source code

#include <LPC214x.H>

void delay(unsigned int lama)
{ /* My PCLK of Timer0 is 12Mhz */
unsigned int d;
for(d=0;d<lama;d++){
T0PR = 9999; // Prescale Register = 9999
T0MR0 = 1200; // Match Register = 900
T0MCR = 0x00000004; // Stop on MR0: the TC and PC will be stopped // and TCR[0] will be set to 0 if MR0 matches the TC.
T0TCR = 0x02; // Counter Reset
T0TCR = 0x01; // Counter Enable
while(T0TC != T0MR0);
T0TC = 0; // TC kembali ke 0
} }

void delay_ms(unsigned int lama_1)
{ /* My PCLK of Timer0 is 12Mhz */
unsigned int d;
for(d=0;d<lama_1;d++){
T0PR = 999; // Prescale Register = 9999
T0MR0 = 12; // Match Register = 900
T0MCR = 0x00000004; // Stop on MR0: the TC and PC will be stopped // and TCR[0] will be set to 0 if MR0 matches the TC.
T0TCR = 0x02; // Counter Reset
T0TCR = 0x01; // Counter Enable
while(T0TC != T0MR0);
T0TC = 0; // TC kembali ke 0
}

}

void delay_ns(unsigned int lama_2)
{ /* My PCLK of Timer0 is 12Mhz */
unsigned int d;
for(d=0;d<lama_2;d++){
T0PR = 1; // Prescale Register = 9999
T0MR0 = 12; // Match Register = 900
T0MCR = 0x00000004; // Stop on MR0: the TC and PC will be stopped // and TCR[0] will be set to 0 if MR0 matches the TC.
T0TCR = 0x02; // Counter Reset
T0TCR = 0x01; // Counter Enable
while(T0TC != T0MR0);
T0TC = 0; // TC kembali ke 0
}

}

int main(void)
{

unsigned int i;
IODIR1 = 0x00FF0000; // set all ports to output

while(1)
{

for(i=0;i<4;i++){
IOSET1 = 0x00010000; //set output pins
delay_ns(200);
IOCLR1 = 0x00010000; //clear output pins
delay_ns(200);
}

delay_ns(19800);

}
}

please enlightenment?!

Parents
  • Just a very unrelated question. The quoted article contains this sentence:
    "That's a wonderful thing compared with the three-day rebuild time we experienced in the early days of the embedded revolution. But it's too often used to displace thinking."

    How many have manged to work with embedded programming where the build times have been even close to that time?

    I don't think I have ever seen build times higher than 10-30 minutes. And similar times for reprogramming the device. So maybe worst-case total spin time of 1-2 hours assuming the code changes didn't require lots of editing or thinking.

Reply
  • Just a very unrelated question. The quoted article contains this sentence:
    "That's a wonderful thing compared with the three-day rebuild time we experienced in the early days of the embedded revolution. But it's too often used to displace thinking."

    How many have manged to work with embedded programming where the build times have been even close to that time?

    I don't think I have ever seen build times higher than 10-30 minutes. And similar times for reprogramming the device. So maybe worst-case total spin time of 1-2 hours assuming the code changes didn't require lots of editing or thinking.

Children