![]() |
Dynamic memory MC18
How exactly do you dynamically allocate memory for an array in C? "New" is not a keyword and malloc does not seem to be included in the IFI library. There has to be a way to allocate memory. Isn't there?
~Cadyyan~ |
Re: Dynamic memory MC18
To the best of my recollection, the PIC18 did not support dynamic memory allocation. You always have the option of declaring a big array at global scope and using that area as "scratch" for dynamic memory operations.
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. EDIT: I have checked and confirmed; the PIC does not support dynamic memory allocation. |
Re: Dynamic memory MC18
Quote:
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:
|
Re: Dynamic memory MC18
Well thanks. I think the best I could do would be to either make an array that "should" be large enough or else write a bunch more code for different scenarios. Thanks again for the responces.
|
| All times are GMT -5. The time now is 01:09. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi