|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||||
|
|||||
|
Re: Arrays on the PIC?
Quote:
If you use ram data space you are limited to 256 bytes of global variables (or static) declared within any one MPLAB file, e.g., "char a[256];". 120 bytes of variables within a single routine. This doesn't mean you can't break the array up into several smaller arrays. A total of 1,343 bytes of ram are available to the user after the IFI overhead. An array of rom constants (those that use program space) can be larger, but can't be modified at run time. EEPROM requires a read/write operation for each value you put in or take out. Last edited by Mark McLeod : 03-12-2004 at 23:14. |
|
#2
|
|||||
|
|||||
|
Re: Arrays on the PIC?
Quote:
Thanks for the help. |
|
#3
|
|||||
|
|||||
|
Re: Arrays on the PIC?
Quote:
|
|
#4
|
||||
|
||||
|
Re: Arrays on the PIC?
Quote:
I used multidimensional arrays in ROM space with no issues. I address the array by pointer reference and index from there. I don't have any arrays in RAM space so I can't speak to that... Are you dynamically allocating storage or anything strange like that? |
|
#5
|
|||||
|
|||||
|
Re: Arrays on the PIC?
Quote:
I also use multi-dimensional arrays without problems, however, my main programmer coded an algorithm Fall 2003 using a multi-dimensional array in ram to empirically develop some constant values. When he simply changed the declaration to rom after fixing his constants the code choked. No dynamic allocation of memory (especially since it was in rom ).I don’t remember the details (it was almost a year ago), and don't think those details are germaine to poor scitobor here . When I debugged the problem I did change how his code used pointer arithmetic, but only because his particular application ran into an odd compiler bug. It generated incorrect assembly (no he wasn’t optimizing – I knew you guys reading this were thinking that). It’s probably gone from the latest version shipped with the KOP this year.Hence the caution and suggestion that one might benefit from testing a simplified skeleton of an algorithm using rom multi-dimensional arrays. I consider that good practice for the students in any case. Last edited by Mark McLeod : 05-12-2004 at 21:31. |
|
#6
|
||||
|
||||
|
Re: Arrays on the PIC?
Two possibilities come to mind. Your student may have been using a byte index in RAM and did not change it to a word for ROM. The other is that, if he or she was using pointers, the pointer had to change to ROM CONST also...
At any rate, it sounds like a moot point now. If anyone else has problems, let us know... |
|
#7
|
|||||
|
|||||
|
Re: Arrays on the PIC?
Quote:
I have on my "to do" list an off-season debugging workshop where the more advanced student programmers have to find what's wrong with a collection of misbehaving projects and code ranging from obvious MPLAB issues to subtle code problems. Last edited by Mark McLeod : 06-12-2004 at 09:18. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| pic: 294's First Inventor Robot (pic 1)... | CD47-Bot | Robot Showcase | 4 | 10-03-2004 19:34 |
| pic: pic 1 | CD47-Bot | Robot Showcase | 6 | 22-02-2004 00:29 |
| TCP/IP on a PIC | Venkatesh | Electrical | 1 | 18-11-2003 21:00 |
| pic: Another pic of Team 930 | CD47-Bot | Robot Showcase | 7 | 25-02-2003 21:07 |