Jump to content
43oh

HD44780-based LCD - cursor problem


Recommended Posts

Can anyone help me with my C structure?

 

I have all the code I want, but I can't seem to get the headers and includes right. They are all there, but CCS gives the error:

could not open source file "LCD-defines.h" (or some other header file, depending on what I mucked up)

 

I'm sure it's just because of poor structure/layout of my code. Any help/tutoring is greatly appreciated, as usual.

 

-Doc

Link to post
Share on other sites
Could you paste the full error.. it will tell you the .c file and line number.

If your comfortable, you could zip your folder.

I am forever sending messages without the attachments! :oops: Sorry... I meant to have it in the last post.

 

Not worried about sharing the code. It was going in a new post when finished anyway. ;)

LCD-Test.zip

Link to post
Share on other sites
In LCD-functions.c,

"defines" is misspelled.

Fix:Rename "LCD-defines.h" to "LCD-definies.h"

You will also eventually need "LCD-functions.h" which was not included in the zip file.

Stupid misspellings! (LCD-functions.h should be LCD-functions.c, also). Thanks.

 

I made another dumb programming error I need to fix (in LCD_sendByte() I try to modify some constants :oops: ) before I test it out, but I'm close.

 

Bed now. Code tomorrow.

 

-Doc

Link to post
Share on other sites

@doc i am no master, just happened to "need" to use all io pins on my clock project and thus more familiar w/ them.

everyone has their area of expertises. i am learning a great lot from posts here. especially lately on the uart and spi area.

people will come across all these topics and could use the info we shared here.

Link to post
Share on other sites

Okay, simplify, simplify, and I got rid of almost all the errors (along with consolidating most of the files). How do I get rid of the circular #include reference? No matter which #include I remove, I get a ton of errors due to "undefined" constants/etc. But, LCD.h #includes LCD.c, and LCD.c #includes LCD.h, and I can't remove either one. Should I just combine the two and be done with it? :?

 

-Doc

LCD-Test.zip

Link to post
Share on other sites

To me, the problem seems to be your heavy use of the "extern" keyword. It's un-needed in any of those files, but the file causing issues is lcd.h.

 

The code (starting on line 70):

extern void vWait( int uibaseinterval,  int ucrounds);
extern void LCD_init(void);
void LCD_sendByte( char data);
extern void LCD_inst( char data);
extern void LCD_char( char data);
extern void LCD_string(char const *point);
extern void LCD_cursor( char data);
extern void LCD_write_CGRAM( char CGR_addr,const char *CGR_data);
extern void LCD_init_CGRAM(void);
extern void LCD_disp_allpixels (void);

 

I'd just take the extern off of those. Your function calls will all be in the right scope, so long as you include lcd.h. If lcd.c is in your project, CCS/IAR/gcc will know enough to compile it without you telling it to. Including lcd.h lets the compiler know that those functions exist and will be found elsewhere. Using extern here is just overkill and confusing the compiler. Or, at least that's what I think. I could be wrong. Try it and see?

Link to post
Share on other sites
  • 3 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...