We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I am a beginner to C language... I have alreaady initialized the LCD in my code...How do i display a message("HELLO" eg.) to LCD? I want to use it in function void but i do not know where to start...I want to make it simple if possible...There are samples that i found but the samples are complicated...
There are no function void(), and there never will be. At least not in the C language.
If the examples are a bit complicated, then maybe they need to be a bit complicated.
Your post does not contain any information that can help anyone answer your question. But if you have managed to initialize your display, then it should be quite easy to switch from sending commands to it to instead send data to it.
Even if the example programs may look complicated, it should be quite easy to notice how they separate between sending data and commands. But then, that information is very well described in the datasheet for the display.
http://www.keil.com/appnotes/docs/apnt_161.asp
Hi again Fiddeley Geek,
you thought youd hide in another msg eh??
Mister Slavenders expecting his work v soon
the saddos here aint goin to help yeou
what you on aboot with the 'I am a beginner to C language'? youve been on the course for 9 months now!
Wah you must be really OUT OF YOUR MIND!!! Do you know that i am just a TEENAGER who is asking for help in my SCHOOL PROJECT that is due in a FEW WEEKS... now you are telling me i've been in a course for nine months... Why are you starting all this mess?? I think you better confront your FIDDELEY GEEK!!!
il'l keep quiet from now on.
i wont even tell Mister Slavenders!
But the saying about C goes: A minute to learn, a lifetime to master.
Hm. Where does that leave C++? "Five minutes to learn, abandon all hope..."?
Not sure if anyone have managed to learn C++ yet...
I try to write it in this way...I am trying to display the letter 'c' to my 8x2 LCD but a line of square dots keep on displaying on the LCD,without displaying a letter.
void lcdwrite(char *letter) { while(*letter) { lcddata(*letter); letter++; } } void main() { Init_Device(); lcdinit(); lcd_clear(); lcdwrite('c'); }
http://www.keil.com/forum/docs/thread10256.asp
Your definition of lcdwrite has:
void lcdwrite(char *letter)
but your call to it is
lcdwrite('c');
Spot the mismatch?
The lcdwrite function expects not a character but a pointer to a character or rather a pointer to a number of characters in wich the last character has the value 0x00. This is called a nullterminated string. So it would be better to make the function call look like this:
lcdwrite("Hello world")
Was there no warning message by the compiler?
It seems I am way too slow in posting...
mate,
Our teech told us about this two weeks ago. Look at your revision notes on page 3 where he even gave us an example!
"Look at your revision notes on page 3"
That's the trouble with having all your documentation separate from the source code!
Learn the habit now of always fully-commenting your code (with specific references to external documents where necessary)
For example: All functions should have a descriptive header; All variable definitions should clearly state their purpose, usage, range of values, units of measure, etc
eg
// Write a null-terminated string to the LCD void lcdwrite ( char *letter // Input: pointer to the string to write ) { while(*letter) { lcddata(*letter); letter++; } }
Think also that "letter" was not a good choice of name for the parameter, was it?