problem in avr c codes

Thread Starter

khan yousufzai

Joined Aug 31, 2012
19
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;
}
 

Papabravo

Joined Feb 24, 2006
21,225
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:
Top