GeekDoc 226 Posted October 17, 2010 Author Share Posted October 17, 2010 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 Quote Link to post Share on other sites
bluehash 1,581 Posted October 17, 2010 Share Posted October 17, 2010 Could you paste the full error.. it will tell you the .c file and line number. If your comfortable, you could zip your folder. Quote Link to post Share on other sites
GeekDoc 226 Posted October 17, 2010 Author Share Posted October 17, 2010 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 Quote Link to post Share on other sites
bluehash 1,581 Posted October 17, 2010 Share Posted October 17, 2010 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. GeekDoc 1 Quote Link to post Share on other sites
GeekDoc 226 Posted October 17, 2010 Author Share Posted October 17, 2010 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 Quote Link to post Share on other sites
simpleavr 399 Posted October 17, 2010 Share Posted October 17, 2010 @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. Quote Link to post Share on other sites
GeekDoc 226 Posted October 17, 2010 Author Share Posted October 17, 2010 @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. For me, [knows cool/useful feature I don't know] == "master" -Doc Quote Link to post Share on other sites
GeekDoc 226 Posted October 17, 2010 Author Share Posted October 17, 2010 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 Quote Link to post Share on other sites
gatesphere 45 Posted October 18, 2010 Share Posted October 18, 2010 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? GeekDoc 1 Quote Link to post Share on other sites
bluehash 1,581 Posted October 18, 2010 Share Posted October 18, 2010 Remove all the externs as gatesphere suggested. Also LCD_data() is not declared nor defined. Those functions need to be resolved first. GeekDoc 1 Quote Link to post Share on other sites
bluehash 1,581 Posted November 4, 2010 Share Posted November 4, 2010 Hi geekdoc, I know you work on this when you get time... but here is another reference project I found. GeekDoc 1 Quote Link to post Share on other sites
GeekDoc 226 Posted November 4, 2010 Author Share Posted November 4, 2010 I know you work on this when you get time... but here is another reference project I found. Excellent! I'll be looking at the code tomorrow. Maybe I can drop my flailing attempts and use this. Then I can move on with my Meter-Monitor project. Hmmm... POM entry? Quote Link to post Share on other sites
bluehash 1,581 Posted November 4, 2010 Share Posted November 4, 2010 Hmmm... POM entry? Of course! Send it in. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.