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

problem in string display

#include<reg51.h>
#include<string.h>
#include<stdio.h>
#define lcd_data P1
sbit rs=P2^0;
sbit rw=P2^1;
sbit en=P2^2;
unsigned char n[5]="hello";
unsigned char m[]="welcome rakesh";
void cmd_lcd(unsigned char);
void write_lcd(char);
void delay(unsigned int);
void lcd_int()
{ cmd_lcd(0x38); cmd_lcd(0x0c); cmd_lcd(0x01); cmd_lcd(0x80);
} void cmd_lcd(unsigned char x)
{ x=lcd_data;
rs=0;
rw=0;
en=1;
delay(50);
en=0;
}

void write_lcd(char s)
{

s=lcd_data;
rs=1;
rw=0;
en=1;
delay(500);
en=0;
} void delay(unsigned int temp)
{ unsigned int i,j;
for(i=0;i<255;i++);
for(j=0;j<temp;j++);
}

void main()
{ void lcd_int(); void write_lcd(n); void delay(500); void cmd_lcd(0x01); void delay(100); void write_lcd(m); void delay(100);
}

this code shows following error:
Build target 'Target 1'
compiling lcdc04.c...
LCDC04.C(50): error C161: 'n': formal parameter ignored
Target not created

please help me in clearing this...

Parents
  • "You said that what Jameel was telling the OP was wrong, but then you provide a link which actually supports what he said."

    No, Jameel is stuck on function invocation; that is, calling. There is no "calling" being performed. The code's incorrectness hasn't even allowed lint to complain about a function call (yet).

Reply
  • "You said that what Jameel was telling the OP was wrong, but then you provide a link which actually supports what he said."

    No, Jameel is stuck on function invocation; that is, calling. There is no "calling" being performed. The code's incorrectness hasn't even allowed lint to complain about a function call (yet).

Children
  • Quite interesting that people refuse to read code before "knowing" what the code does. And people who refuse to read compiler error messages and look in text books to verify the assumptions about how code is expected to be written.

    First comes the OP with some "very interesting" code containing quite a number of errors (probably just a partial list - it's hard to read when the formatting is junked because of missing tags in the post):
    - reversed assigns
    - "nested" loops that aren't nested
    - void where no void should be
    - one string without zero-termination and one string with - how will the print code know how many characters to print?
    - interesting mix of arrays and characters
    - a function with empty () instead of (void) which might not be what was intended, depending on language selected
    - a main that terminates out into the unknown
    - a refusal to add comments or label the magic numbers used

    Then come a "helper" who haven't made sure he understands the line he is commenting about. And doesn't spend a bit of extra time checking it again when told he is wrong.

  • Then come a "helper" who haven't made sure he understands the line he is commenting about. And doesn't spend a bit of extra time checking it again when told he is wrong.

    But the two things that Jameel mentioned are not wrong per se. He mentioned two things that are genuine faults. Ok, he missed some others and really stated those two in the wrong order, but the long and the short of it is that he just got knocked big time for stating faults.

    It seems that this forum does not permit beginners helping beginners.

    Quite extraordinary.

  • It seems that this forum does not permit beginners helping beginners.

    Judging by the quality of the code and advice, it is quite possible that one or both are consultants.

  • But the line he discussed wasn't a function call - so his description of calling the function with wrong data just couldn't be correct. A function that never gets called will never output anything.

  • But the line he discussed wasn't a function call - so his description of calling the function with wrong data just couldn't be correct

    But would you not say that it was obviously an attempt to call a function? And once the void was corrected (which, lets not forget, Jameel also mentioned), the incorrect parameter type would also need correcting.

    You yourself provided a number of faults you noticed, so I do wonder. Did you enter the code, compile, take a note of the reported error, fix it, re-compile and repeat until there were no more errors or did you do a quick scan of the code to see problems by eye?

    Surely the latter.

    Is it not likely that Jameel did the same? Maybe, just maybe, his eye is not yet as well tuned to seeing problems in badly/incorrectly formatted code as you. But a little credit for seeing one genuine fault would be way more constructive than the negatives he received.

  • When making a statement and someone else says it is wrong, then it might be an idea to invest some real time trying to figure out what is going on. Or take one step back and post a question "in what way?" or "how do you mean?" instead of just pushing ahead with a post repeating the claim "void write_lcd(n); // calling write_lcd with n ".

    "Is it not likely that Jameel did the same? Maybe, just maybe, his eye is not yet as well tuned to seeing problems in badly/incorrectly formatted code as you."

    The problem wasn't that he missed an important issue with the line. The problem was that he came back again, a second time claiming that a call was made. Thereby starting a debate instead of taking the chance of learning one of the intricacies of the C language.

  • The problem wasn't that he missed an important issue with the line. The problem was that he came back again, a second time claiming that a call was made

    On that we obviously disagree. Yes, he missed an important issue at first. But he also raised a perfectly valid (and arguably equally important) issue. He also added:

    (Rakesh mate. look at the void.)

    Not a bad clue.

    I just hope that the negative responses he received do not deter him from attempting to be helpful in the future.

  • We may disagree. But I really can not for the life of me see any issue with receiving the answer "No, he doesn't." when that is correct. There really has to be a limit to how sensitive people may be if they want to log on to the net or leave their home and take a stroll.

  • Judging by the quality of the code and advice, it is quite possible that one or both are consultants.

    hey, man: thanks for your encourage. i told them i'm write. U see it.

  • "(Rakesh mate. look at the void.)

    Not a bad clue."

    i should have told too parents the void for better clue.

  • look man.

    why do you pretend to be me? it is not cool.

    whatever. you probably feel very small and want to feel big.

  • He also added:

    (Rakesh mate. look at the void.)

    Not a bad clue.

    That he did. After twice claiming the opposite. And when he finally admitted his mistake, he made every effort to avoid it being noticed: an extremely vague hint, in parentheses, in the middle of an unrelated argument.

    That's not a clue: it's somebody doing his best to avoid the notion that he proclaimed nonsense twice in a row, now hedging his bets by dropping a vague hint pointing in the direction of where he's now beginning to see his mistake must have lain.

  • That he did. After twice claiming the opposite. ...

    LMFAO.

    Would you give me your address? I would like to forward you a series of books on a collection of subjects to help you with your apparent deficiencies.

  • "LMFAO."

    You should stick with acting. Your man-fly portrayal was funny.

  • You should stick with acting. Your man-fly portrayal was funny.

    Ah, I see what you did there. You took my name and likened it to the actor in the film "The Fly"; a Jeff Goldblum.

    How witty.