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?!
"The time "this is a problem for the forum" is when you have narrowed the problem down to something you can describe as a specific problem"
I thought the thread title "Not working" did describe a very specific problem.
I always tell the doctor "Not working". Same if I turn in my car. After all, the doctor or car mechanic are schooled and payed to be able to find errors. Why give them hints?
www.eetimes.com/.../Developing-a-good-bedside-manner
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.
Hyperbole?
" here: http://www.keil.com/forum/19564/
when the king of diamonds were just a jack embedded computing used minicomputers.
I recall assembly of 3k of code on a PDP-8 with a 10cps teletype taking 8 hours (2 passes of a spool of paper tape).
Erik
sorry in advance. . . I'm just learning to program the microcontroller. . . so forgive if you are not pleased. .
"sorry in advance. . . I'm just learning to program the microcontroller. . . so forgive if you are not pleased."
So. 1) Have you walked through my individual items in my first post? Your response?
2) Is it relevant if you have just started to learn programming microcontrollers? In how many other areas of the world would "not working" be a good description of a problem? Wouldn't you agree that if you are stuck, you are much more likely to get good answers if you tell where you are stuck, and what you have tried. What you expected to happen, and what really happened? What you have thought could be causing the problem, and how you have tried to check if it is so?
www.catb.org/.../smart-questions.html
Some tips on debugging:
www.8052.com/.../120313
" href= "http://www.danlhenry.com/caps/keil_code.png">www.danlhenry.com/.../keil_code.png
okeh I apologize in advance. . .
I will not repeat again. . .
So did you understand the problems with your code?