PDA

View Full Version : Maximum variable array ?



Keith55555
- 30th April 2004, 18:27
How does one calculate the maximum availabel size, for an array ,with byte size data, on the 12F675?Thanks,Keith

picnaut
- 1st May 2004, 00:33
Hi Keith,

On the PIC16F877 an array can only be 96 bytes.
I believe that's the amount of RAM in one bank.
I'm not sure how the memory on the 12F675 is organized.
If you have more than one bank (I doubt it) you should be able to create one array that holds as many bytes as are available in that bank. The other bank will be used for your program's variables and overhead created by the PBP compiler.
It's going to be tight to be sure.
If there is only one bank then you are simply going to have to feel it out for yourself.

Cheers.

Melanie
- 1st May 2004, 07:54
Easily calculated with the aid of PBP itself... write your program, define your array and compile. If it's too big, PBP will respond with an error message. So just keep increasing the array size until you reach the point PBP will fail compiling.

Little factors will affect the array size... like if you define other variables before or after your array. Unfortunately, trial and error is the only surefire method to determine the best arangement.

I did play around with this for a program I wrote a couple of years back, and surprisingly discovered that the maximum array for PIC's like the 16F84 can be as little as 40-something bytes.

Melanie

Dwayne
- 3rd May 2004, 17:01
Hello Melanie,

Just for a thought.....

Since the chips store arrays as a string of characters, and using the idea of using programming space.

Could you not put large strings at the end of your Programming space, and access it? Thus increasing the size of a array?

Am I just thinking all wrong? or is this not a possibility?

And then ( I am adding this about 2 hours later <g>) Since the 675 has 128 bytes of EEProm, could not this be used as a Array also? Granted, I realize that you would have to manually manipulate the array to some degree.


Dwayne(Sometimes this kid just has to be straightened out by the professional PBP'ers!)

Melanie
- 5th May 2004, 08:35
All those are good and valid idea's... but there are drawbacks.

I did a thread on this... "Making Program Code Space your playground" last November. Do a search on "Playground".

Yes, you can use EEPROM space too... it's just that with EEPROM there is a time-factor of around 10mS in the write operation.

I use both those methods for storing strings for LCD Displays... things like Setup Menu Trees etc... as MeLabs string handling is cumbersome for large quantities of messages etc.

Being too slow during the write cycle, neither are any good however for fast applications (like using a circular buffer for Serial Comms for example).

Keith55555
- 5th May 2004, 15:28
My application involved exactly that : 'a circular buffer',so the E2prom was out because of 'write time'.What I worried about using data space was being confronted with read/modify/write complications within the program itself.I would have to have something within the program that monitored the space I allocated for this buffer.I think this may be a case of short sightedness in laying out my circuit(more like wishful thinking in retrospect).I am about to re-design the board and am considering external hardware so as to have plenty of 'ceiling' for a substantial buffer.Some SRAM comes to mind but I was looking at some E2PROM that seems to have a much improved write times (compared to the on-chip E2PROM)that seem to come within the timing parameters. -Keith

Melanie
- 6th May 2004, 10:16
If you can't chose a PIC with a lot more RAM inside for your circular buffer (easiest and probably cheapest option), then consider FRAM...

http://www.ramtron.com/doc/AboutFRAM/overview.asp

non volatile (like EEPROM), but fast (like RAM).

picnaut
- 7th May 2004, 04:13
Hi Melanie,

Those FRAM chips look cool.
I don't suppose they make any in a dip package do they?
I didn't see any.
Maybe I'm just blind.

Cheers.

Keith55555
- 7th May 2004, 04:23
Those ARE way cool.I see a DIP package in the photo ,under products.For my money,there are some very sexy SMTs,thoughThey're like a static(and I do mean,'does not move) drive.Bet those cost a bit.Digikey does not have them.Think I've read about them a while ago but this is the first I see them outside of a press release.

Melanie
- 7th May 2004, 08:24
They're all SMD but perfect for Datalogging - especially the one with an RTC built in... just perfect for instant plastic Chicken applications...

Keith55555
- 7th May 2004, 14:29
The parallel one's at the bottom of the page,marked with a 'P'(for example the fm1608 ,I believe was the number) are both SMT AND DIP . All the serial one's are smt