Keil Logo Arm Logo

Discussion Forum

keil cx51 for loop not working

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Details Message
Read-Only
Author
sreenadh s
Posted
24-Dec-2007 11:27 GMT
Toolset
C51
New! keil cx51 for loop not working

When I compiled my C program in keil cx51
the "for loop" is not working what is the solution?

Read-Only
Author
Per Westermark
Posted
24-Dec-2007 11:39 GMT
Toolset
C51
New! RE: keil cx51 for loop not working
Read-Only
Author
Per Westermark
Posted
24-Dec-2007 11:39 GMT
Toolset
C51
New! RE: keil cx51 for loop not working

The solution is to fix the "for loop".

Do you notice something? You seem to have forgotten to post your "for loop", so we can't help you by telling you what you have done wrong. Please also notice the instruction about how to post source code.

Always (!) spend some time making sure that your questions are complete enough that people can have a chance to answer them. One minute saved when writing your question will waste your hours or days while waiting for an answer!

Read-Only
Author
sreenadh s
Posted
24-Dec-2007 11:51 GMT
Toolset
C51
New! RE: keil cx51 for loop not working

Transmit_uart("Descriptor data\n\r"); datadisp(number_of_ep);

device_max_power=2*payload[0x22];

pyld_index=0x2c;
///////////////////////////////////////////////////////

When the code above added it is not working
other wise it is working
////////////////////////////////////////////////////
for(count=0;count<number_of_ep;count++)
{

epdata[count].ep_number=(UC)(payload[pyld_index+2]&0x0f);

epdata[count].ep_direction=(UC)(payload[pyld_index+2]>>7);

epdata[count].ep_type=(UC)(payload[pyld_index+3]&0x03);

epdata[count].ep_maxp_size=(UC)(payload[pyld_index+5]&0x07); epdata[count].ep_maxp_size=(UC)((epdata[count].ep_maxp_size<<8)+payload[pyld_index+4]);

epdata[count].ep_mult=(UC)((payload[pyld_index+5]>>3)+1);

epdata[count].ep_poll_intrvl=(UC)(payload[pyld_index+6]);

pyld_index=pyld_index+7;
}

Read-Only
Author
Per Westermark
Posted
24-Dec-2007 12:10 GMT
Toolset
C51
New! RE: keil cx51 for loop not working

What part of Please also notice the instruction about how to post source code where you unable to understand?

Did you really look at the insttructions how to post source code?

Do your code look like the following?

for (i = 0; i < 10; i++) {
    ;
}

Notice the difference? Your code should look like that if you where following the instructions for posting source code!

By the way: Have you based your code on an example? Which example?

How is Transmit_uart() defined?

What does datadisp() do?

You haven't told us what your problem is. What is happending, and what did you expect to happen?

How have your tried to resolve your problem?

Is the for loop run, or does number_of_ep have an invalid value?

What (incorrect) symptoms do you get?

Read-Only
Author
Andy Neil
Posted
24-Dec-2007 14:15 GMT
Toolset
C51
New! RE: instruction about how to post source code

The instructions on how to post source code are very clearly displayed immediately above the box where you typed your message.

But, if even that isn't enough for you, here's a picture to make it blindingly obvious:
http://www.danlhenry.com/caps/keil_code.png

Next Thread | Thread List | Previous Thread Start a Thread | Settings

Keil logo

Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.