- This topic has 1 reply, 2 voices, and was last updated 9 years, 6 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
|
Microcontroller › 8051 › LCD BASIC
I have a doubt in LCD code. i know, its silly question for u people but it makes big difference for me. Please 1st go through the code and at the end my questions are:
void lcdcmd(unsigned char item) //Function to send command to LCD
{
dataport = item;
rs= 0;
rw=0;
e=1;
delay(1);
e=0;
}
void lcddata(unsigned char item) //Function to send data to LCD
{
dataport = item;
rs= 1;
rw=0;
e=1;
delay(1);
e=0;
}
void main()
{
lcdcmd(0x38);
lcddata('A');
}
1. Inside the main() when we call function " lcdcmd(0x38); , the control goes on function defintion.
the function is:
void lcdcmd(unsigned char item) ;
how char datatype accept hex value i.e. 0x38 as a argument and now the arguments pass to the dataport
dataport=item; // what does this line means. It is necessary to give the command to the data port.
Thanks in Advance !!!
dataport is a symbole created using #define
it does not mean it will accept only data. its a hardware port of 8051
in embedded C for 8051 the data must of 8 bit
and unsigned char is only 8 bit data. that's why we are using unsigned char