The 8051 micro-controller(P89V51RD2FN) that I have been using is configured on a 11.0592 Mhz crystal. But the delays do not respond as per programmed. The programs are perfectly written and there is no issue in the code. Is my controller faulty? How to check that? Please provide some troubleshoot tips and tricks. Thank you very much.
Lol everyone please calm down I am just a beginner. A 3rd year Engineering student. Just trying to learn something. Do not pounce on me I am not a professional. My question is How to check if a controller is working or not. Mine is not responding properly!
how can I am just a beginner state The programs are perfectly written
having worked vith youngsters I have heard the above many times when it was incorrect.
questioms delay loop in C or asm optimization level show your delay code
Erik
Mine is not responding properly!
The most likely fix for that is to correct your code. Stop whimpering like an idiot. You must face the fact that you have made a mistake. Grow up a bit and just do it.
I have already given more of my precious time than you really deserve and will not discuss further. Goodbye.
Sorry Mr. Bill Gates! Carry on with your busy schedule. I didn't ask you to nag on my problem. If I was really an idiot why would have given me attention. Probably you are a bigger one!! Get yourself a psychiatrist. Pathetic people!!
"Mine is not responding properly!"
That is almost certainly due to your code rather than a faulty chip.
However, if you really think that your chip is faulty, your should take it to an appropriate member of staff (ask your teacher if unsure) who will have the facilities to test it for you; eg, by loading a known-working application, or by loading your application into a known-working chip.
"Do not pounce on me I am not a professional"
So don't set yourself up by saying stuff like, "my code is perfect"...
The most sensible reply that I found in this forum! thanks a lot... actually I have tried it on another chip and the code works perfectly. However in this faulty chip the same codes work but the time delays are altered. So I was emphasizing upon how to test the hardware!
"However in this faulty chip"
How many times are you going to repeat this idiotic statement? Will you ever realize your code is at fault here?
Take this *** and tell me the fault man!! /* BLINKY.C - LED Flasher for the Keil MCBx51 Evaluation Board with 80C51 device*/
#include <REGX51.H>
// When you have enabled the option Stop Program Execution with Serial // Interrupt, the Monitor-51 uses the serial interrupt of the UART. // It is therefore required to reserve the memory locations for the interrupt // vector. You can do this by adding one of the following code lines:
// char code reserve [3] _at_ 0x23; // when using on-chip UART for communication // char code reserve [3] _at_ 0x3; // when using off-chip UART for communication
void wait (void) { /* wait function */ ; /* only to delay for LED flashes */ }
void main (void) { unsigned int i; /* Delay var */ unsigned char j; /* LED var */
while (1) { /* Loop forever */ for (j=0x01; j< 0x80; j<<=1) { /* Blink LED 0, 1, 2, 3, 4, 5, 6 */ P3 = j; /* Output to LED Port */ for (i = 0; i < 30000; i++) { /* Delay for 10000 Counts */ wait (); /* call wait function */ } }
for (j=0x80; j> 0x01; j>>=1) { /* Blink LED 6, 5, 4, 3, 2, 1 */ P3 = j; /* Output to LED Port */ for (i = 0; i < 10000; i++) { /* Delay for 10000 Counts */ wait (); /* call wait function */ } } } }
Take this *** and tell me the fault man!!
Look fool. If you describe your code as *** and you post it in the same *** manner then your expectation of anything apart from ridicule just shows you for what you are ... an idiot.
Ever thought of attempting a simpler course? Like basic cooking for morons?
I thought I'd make his code even more perfect.
Faulty controller or faulty programmer?
I know which one I would say.
#include <REGX51.H> void wait (void) { ; } void main (void) { unsigned int i; /* Delay var */ unsigned char j; /* LED var */ while (1) { /* Loop forever */ for (j=0x01; j< 0x80; j<<=1) { /* Blink LED 0, 1, 2, 3, 4, 5, 6 */ P3 = j; /* Output to LED Port */ for (i = 0; i < 30000; i++) { /* Delay for 10000 Counts */ wait (); /* call wait function */ } } for (j=0x80; j> 0x01; j>>=1) { /* Blink LED 6, 5, 4, 3, 2, 1 */ P3 = j; /* Output to LED Port */ for (i = 0; i < 10000; i++) { /* Delay for 10000 Counts */ wait (); /* call wait function */ } } } }
All the nice words used in this thread shows the level some people manages...
Anyway - don't do for loops. Bind your delays to timer hardware. Unless you don't want it to work...
Bind your delays to timer hardware. Unless you don't want it to work... OR write them in assembler
it is the correct action of a good optimizer to say that this code
for (i = 0; i < 30000; i++) { /* Delay for 10000 Counts */ wait (); /* call wait function */ }
affect nothing and thus should be ignored
Try setting the optimization level to zero
also what happens when main() ends?
you state above: // char code reserve [3] _at_ 0x23; // when using on-chip UART for communication // char code reserve [3] _at_ 0x3; // when using off-chip UART for communication Indicating you are using a monitor (it took a while for you to tell us that)
and have this
for (j=0x01; j< 0x80; j<<=1) { /* Blink LED 0, 1, 2, 3, 4, 5, 6 */ P3 = j; /* Output to LED Port */
since the UART uses P3.0 and P3.1 something stinks
All right Thank you very much everybody. And a bigger thanks to some 'WISE' people who found time to criticize people telling them 'idiot' and whatever. It shows your level hahah!! Take care and don't mess anyone else's thread this way. You never know who is there on the other side. So do not display your foolishness on-line at least.
The code is pretty awful and his posting techniques severely lacking, but falling off 'main' (surprisingly) isn't an issue here. He's got the:
while (1)
The code is pretty awful and his posting techniques severely lacking, which kind of hides that
falling off 'main' (surprisingly) isn't an issue here