![]() |
![]() |
![]() |
|
|
|||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
|
|
Thread Tools | Display Modes |
|
|
(permalink) |
|
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! |
|
|
|
|
|
|
(permalink) | |
|
Quote:
Code:
void initializeLCD(void); |
||
|
|
|
|
|
(permalink) |
|
Thanks, that fixed the first problem!
|
|
|
|
|
|
|
(permalink) | |
|
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. |
||
|
|
|
|
|
(permalink) |
|
Thanks for the info Papabravo, that helps a lot, I will post back when I figure it out!
|
|
|
|
|
|
|
(permalink) |
|
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 08:27 AM. |
|
|
|
|
|
|
(permalink) |
|
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. |
|
|
|
|
|
|
(permalink) | |
|
Quote:
Good Luck
__________________
We never have time to do it right; but we always have time to do it over. |
||
|
|
|
|
|
(permalink) | |
|
Quote:
near rom far rom near ram far ram But generally you can just use rom and ram. Mike. |
||
|
|
|
|
|
(permalink) |
|
Thanks a lot Pommie, your code has really saved me a lot of time. I would have never figured that out.
|
|
|
|
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Latest |
| C18 compiler. struct issues. | HerbertMunch | Micro Controllers | 7 | 31st December 2007 01:43 AM |
| Problem setting up timer Interrupt using C18 compiler | elec123 | Micro Controllers | 4 | 14th November 2007 10:59 AM |
| Best Pic Basic Compiler ... | simrantogether | Micro Controllers | 12 | 29th October 2007 07:51 AM |
| Compiler for pic PicForge info ? | ZEPHIR | Micro Controllers | 0 | 23rd October 2007 08:35 AM |
| Hash Function for PIC | pikstart | Micro Controllers | 15 | 8th September 2007 01:07 PM |