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

conditional if statement

i want use if satement, to do something for the one time, example:

main(){
char k;
k=0;

while(1){

if(k==0){
printfLCD("please only one time\n");
k=1;
}//end if

printfLCD("test message\n");

}//end while
}//end main

but it isnt work, program enters the if statement infinite time. where is the error?, there is anyything about keilc51, which is i dont know? i use upsd3434 8051 microcontroler, sory for my nglish

Parents Reply Children
  • how can i fallow my variables changing when debugging
    I know that 'read' is a 4 letter word, but, unfortunately the answer to your question is "read the documentation for the debugger". Any debugger without the ability to view a variable, would be too ridiculous to even be released.

    Erik

  • how can i fallow my variables changing when debugging?

    The debugger should offer the ability to "watch" variables and memory locations, as well as "view" whole ranges of memory.

    If it doesn't, throw it out and get one that does.

  • If after extensive reads, you find it doesn't, throw it out and get one that does.

    I do not know how much I know of that has been "thrown out" because the user did not take the time to 'find' a feature. I recall some post somewhere "xxx is a piece of crap, it can not .... I threw it out" to which the response was "as stated in the manual, click x>y>z and it is right there.

    the post from the OP "i can started debug sesion ... but i only see" clearly indicates that reading the documentation is considered "unnecessary" or "troublesome" or maybe even "not cool"

    Erik

  • maybe i can say troublesome

    ok. firstly i will study on debugging , then you can see my questions later.

    finally i want to write my last question;

    xdata unsigned int *ptr _at_ 0x8000;
    is this valid? or is this useful?

    for example;
    *(ptr) = 10;

    *(ptr+1) = 11;

    where are the 10 and 11 values ,in xdata

  • your 'condtruct is wrong, here is a "cheat sheet" extracted from my definition file

                                                // pointer in data in
    #define U8DI  unsigned char   idata * data  // data       idata
    #define U8DX  unsigned char   xdata * data  // data       xdata
    #define U8IX  unsigned char   xdata * idata // idata      xdata
    #define U8XX  unsigned char   xdata * xdata // xdata      xdata
    #define U8IC  unsigned char   code  * idata // idata      code
    #define U8DC  unsigned char   code  * data  // data       code
    #define U8XC  unsigned char   code  * xdata // xdata      code
    #define U8CC  unsigned char   code  * code  // code       code
    

    Erik