Quote:
Originally Posted by Jared341
To the best of my recollection, the PIC18 did not support dynamic memory allocation.
|
It's not that the PIC18 won't support it, it's simply not implemented in any of the default libraries. It's not implemented because of limited system resources and the fact that it almost never makes sense to use dynamic allocation on a processor as small as a PIC. With that in mind, you might be able to find a 3rd party implementation, or you could certainly write your own.
To the original poster: I'd ask what you're trying to do that would use dynamic memory. Anything related to robot control should be well-enough understood in advance that you shouldn't need to dynamically allocate anything. You can likely rework your design to not need dynamic memory and be more efficient in the process.
Quote:
|
You could also dig up some EEPROM code and use that as your "dynamic" memory (Kevin Watson had written a nifty utility to read and write EEPROM). Just be aware that EEPROM is typically much slower than using the stack.
|
Yikes, I wouldn't do that. EEPROM has a limited number of write cycles before it wears out. It's meant for long-term storage of data, not random-access while a program is running. Plus, "typically much slower" is a large understatement. Writing to EEPROM can easily be 1,000,000x slower than writing to RAM (yes, that's 1 million times slower).