Discussion in "General help Guidance and Discussion" started by    prajwalsnh    Jul 8, 2013.
Mon Jul 08 2013, 11:47 am
#1
hi guys,

I have written a set of functions for 16x2 lcd interfaced with Atmega8. Its working fine.

but instead of including the functions in the main code i want it to be a library so that i

can use #include"LCD.h" to use those functions. how can i do that?? help please..
Thu Jul 11 2013, 10:16 pm
#2
@ prajwalsnh
the functions you made
now made h file of that functions where only function prototype is defined
in c file make a body of that functions
now there are two files lcd.h and lcd.c
use these files in your project include lcd.h in your project and use it
Fri Jul 12 2013, 11:28 am
#3
@majoka

Thanks for the reply sir. But should i do the ".h" file and ".c" file in keil or simply in a text file??
Tue Jul 16 2013, 11:30 am
#4
it doesn't matter which editor you use. What Majoka saying is, You put all your function definitions in c file say lcd.c and prototypes in h file say lcd.h. Now when you want to use this lcd library in other codes just include header file in your program and add lcd.c file to your project.
Tue Jul 16 2013, 05:09 pm
#5
@Ajay Bhargav

Thank you sir I will try it and get back to you soon
Wed Jul 17 2013, 11:07 am
#6
@Ajay Bhargav

Hello sir i tried the way you told, but it is not working Also im facing a new problem i have used

PORT 3 of AT89S52 as dataport of LCD. But if i change the port to P0 its not working. But for port 3

its working fine.What might be the problem pls help.. The same problem with Atmega 8 too.. I'm

attaching the source code written for AT89S52 and LCD. Pls do see to it and let me know how can i

change the dataport.
Attachment
Wed Jul 17 2013, 12:11 pm
#7
Did you connect pullups on P0? if not then add 10K pullup on Port 0 and try again.
Wed Jul 17 2013, 12:14 pm
#8
@Ajay Bhargav

hi sir Its working now But can you tell me why it happens so??? sometimes it will work absolutely fine but sometimes it wont! I get irritated with it. whats the use of pullup resistors??? I have encountered the same proble many times when i interface LCD. Changing dataport is a big head ache for me.
Thu Jul 18 2013, 11:41 pm
#9
Port 0 is used for address data multiplexing, bi-direction data transfer while memory interfacing. Open drain ports can be pulled to any external voltage which helps to interface external ICs which are at different voltage levels. Hope you understand now.

so if you do not connect pullup, you cannot set your port to high level as there is no drain voltage connected on FET.
Fri Jul 19 2013, 04:47 pm
#10
@Ajay Bhargav

Great Thank you very much sir. I want to try the IR Switch project of Yours:) I have few doubts i will create a new thread for it and pls do help me thanks in advance

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

Clydehet
Wed May 01 2024, 06:44 pm
Davidoried
Wed May 01 2024, 06:11 pm
KevinTab
Sun Apr 28 2024, 05:35 am
Tumergix
Sun Apr 28 2024, 12:59 am
StevenDrulk
Sat Apr 27 2024, 08:47 pm
StephenHauct
Sat Apr 27 2024, 09:38 am
Adamsaf
Sat Apr 27 2024, 07:12 am
Robertphype
Sat Apr 27 2024, 12:23 am