problem in avr c codes

Discussion in 'Embedded Systems and Microcontrollers' started by khan yousufzai, Sep 14, 2012.

  1. khan yousufzai

    Thread Starter New Member

    Aug 31, 2012
    19
    0
    what does the following means in lcd interfacing program????(plz anybody help me brothers)

    lcd_cmd(unsigned char item)
    {
    dataport=item;
    ctlrport=(0<<rs)|(0<<rw)|(1<<en);//i dont understand this
    delay(1);
    ctrlport=(0<<rw)|(0<<rw)|(0<<en);//i dont understand this
    delay(50);
    return;
    }



    in 8051 v define this function as
    lcd_cmd(unsigned char item)
    {
    dataport=item;
    rs=0;
    rw=0;
    en=1;
    delay(1);
    en=0;
    return;
    }
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,148
    1,791
    LCD = LIquid Crystal Display

    Characters are made from a pattern of small dots which the display can make light or dark. So the program in the micro sends ASCII characters to the display and the display shows them to you. Most display controllers can display characters from the Latin alphabet and the Kata Kana Alphabet. Kata Kana is a phonetic alphabet, for writing Japanese.

    << is the shift left operator. The operand on the left hand side is shifted left by a number of bits equal to the operand on the right hand side.
    |, the vertical bar is a bitwise 'or' operation. In Boolean Algebra the OR function is a 1 if either operand is a 1 or if both operands are a 1.

    ctlport and dataport are registers that the micro can write to. I'm not familiar with those names so I can't tell if they are correct or not.

    delay(50) is a function that does nothing for 50 time units, but without more information I can't tell what the time units are. The return statements are redundant and useless since they are not returning a value and are implied by the closing curly brace.

    You might try rounding up a C reference. It really is kind of easy to find online. Oh wait -- that might involve making some effort.

    http://lmgtfy.com/?q=C+reference
     
    Last edited: Sep 14, 2012
    W4GNS likes this.
Loading...