Keil Logo Arm Logo

Discussion Forum

Auto baud error

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

Details Message
Read-Only
Author
Sandeep A
Posted
4-Jul-2012 11:15 GMT
Toolset
C51
New! Auto baud error

#include <REGX51.H>
void delay(unsigned int value);
void main()
{ while(1)
{ P1_0 = ~P1_0; delay(10000);

P1_1 = ~P1_1; delay(40000);

P2_0 = ~P2_0; delay(80000);

P2_1 = ~P2_1; delay(120000);

}
}

void delay(unsigned int value)
{ unsigned int i,j; for(i=0;i<65535;i++); for(j=0;j<value;j++);
}

I cant able to fuse the code in chip(p89v51rd2) using flash magic. It always diplay like "reset device to ISP mode now". Kindly help me regarding this.

Read-Only
Author
erik malund
Posted
5-Jul-2012 15:47 GMT
Toolset
C51
New! This is not a Keil issue, but

using flash magic. It always diplay like "reset device to ISP mode now". Kindly help me regarding this.

This is not a Keil issue, but, if I recall, you need to reset the chip after starting FM. If this is not it post at the FM forum.

Erik

Read-Only
Author
j saralam
Posted
5-Jul-2012 15:51 GMT
Toolset
C51
New! RE: This is not a Keil issue, but

i think i fix the bug in delay for you


unsigned int k;

void delay(unsigned int value)
{
    unsigned int i,j;

    for(i=0;i<65535;i=i+1)
        for(j=0;j<value;j=k+1)
            ;
}

Read-Only
Author
Per Westermark
Posted
5-Jul-2012 16:02 GMT
Toolset
C51
New! RE: This is not a Keil issue, but

Are you just bored, or why do you run around making random posts?

How clever is it to have a loop with loop variable j, that all the time gets "incremented" to j=k+1? So exactly how many iterations does the loop do depending on the size of k in relation to the contents of "value"?

Read-Only
Author
j saralam
Posted
5-Jul-2012 16:06 GMT
Toolset
C51
New! RE: This is not a Keil issue, but

its the processor speed constant. it is very clever because you dont need to change the loop when you change the processor. just change the "k"onstant value. i have lots of code improvement hints at http://www.saralamcodingstandards.com/theverybest

Read-Only
Author
Per Westermark
Posted
5-Jul-2012 16:10 GMT
Toolset
C51
New! RE: This is not a Keil issue, but

But that "clever" constant is incorrectly placed, so it doesn't do what you claim it to do.

And there are still no side effects generated by the function, so the compiler can still throw away everything.

Read-Only
Author
erik malund
Posted
5-Jul-2012 17:10 GMT
Toolset
C51
New! who in Hades cares

The OP present this problem:
I cant able to fuse the code in chip(p89v51rd2) using flash magic
you reply:
i think i fix the bug in delay for you

who in Hades cares if there may be a problem in delay() when he cant't get the code into the chip?

Erik

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

arm-logo-small

Keil logo
Important information

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