![]() | ![]() | ![]() |
| |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
![]() |
| | Tools |
| | #1 |
|
I am working on a new project with the C18 compiler. For the most part things are going well, but I have ran into a few glitches that I cannot figure out. One small thing that I can't figure out is that everytime I compile I get: "Warning [2058] call of function without prototype" Even though the function being called does have a prototype. For instance, on the line where the function initializeLCD() is called, it gives me that warning, however in my header file I have the line: void initializeLCD(); and the header file is included in the project. Anyone know what the deal with this is? Also, I can't seem to get pointers working in C18. I am trying to have a globally addressable array of text that I can read to or write from any function. Any attempt at this has failed. Here is a snippet of where I define my variables: Code: char dataArray[] = "Text Array";
char *pData;
void main (void)
{
OSCCON = 0b01110000; //8MHz Clock
pData = dataArray;
pData = "Testing"; But when I try to pull up pData[0] I get a 0 instead of a T. Also, dataArray is still equal to text array. I've tried a combination of & and * but I just can't seem to get it. Any help would be greatly appreciated! | |
| |
| | #2 | |
| Quote:
Code: void initializeLCD(void); | ||
| |
| | #3 |
|
Thanks, that fixed the first problem!
| |
| |
| | #4 | |
| Quote:
I would look for keywords that help the compiler determine what kind of memory the pointer is pointing at. I went to Princeton and we treat all memory the same. We don't have such problems.
__________________ We never have time to do it right; but we always have time to do it over. | ||
| |
| | #5 |
|
Thanks for the info Papabravo, that helps a lot, I will post back when I figure it out!
| |
| |
| | #6 |
|
Pointers on a pic are one of the most confusing things I've come across. The only way to get a string from ROM into RAM is to copy it manually. Here's my understanding of how to manipulate strings. Code: ram char dataArray[20]="Test Data";
ram char *pData;
//copy string from rom to ram.
void SetString(ram char* RamString,rom char* RomString){
do{
*RamString++=*RomString;
}while(*RomString++!=0);
}
//in main you can then have,
static rom char HW[]="Hello world";
//You can then do,
SetString(dataArray,(rom char*) "Hello World");
//or
SetString(dataArray,HW);
//you can also do,
pData=dataArray;
chr=*pData;
SetString(pData,(rom char*) "Somert else.");
Mike. Last edited by Pommie; 3rd April 2008 at 09:27 AM. | |
| |
| | #7 |
|
So are "ram" and "rom" the keyword qualifiers in the C18 compiler?
__________________ We never have time to do it right; but we always have time to do it over. | |
| |
| | #8 | |
| Quote:
Good Luck
__________________ We never have time to do it right; but we always have time to do it over. | ||
| |
| | #9 | |
| Quote:
near rom far rom near ram far ram But generally you can just use rom and ram. Mike. | ||
| |
| | #10 |
|
Thanks a lot Pommie, your code has really saved me a lot of time. I would have never figured that out. | |
| |
|
| Tags |
| c18_memory |
| Thread Tools | |
| Display Modes | |
| |
Similar | ||||
| Title | Starter | Forum | Replies | Latest |
| C18 compiler. struct issues. | HerbertMunch | Micro Controllers | 7 | 31st December 2007 02:44 AM |
| Problem setting up timer Interrupt using C18 compiler | elec123 | Micro Controllers | 4 | 14th November 2007 11:59 AM |
| Best Pic Basic Compiler ... | simrantogether | Micro Controllers | 12 | 29th October 2007 08:52 AM |
| Compiler for pic PicForge info ? | ZEPHIR | Micro Controllers | 0 | 23rd October 2007 09:36 AM |
| Hash Function for PIC | pikstart | Micro Controllers | 15 | 8th September 2007 02:07 PM |