View previous topic :: View next topic |
Author |
Message |
bcs99
Joined: 22 Nov 2003 Posts: 32
|
running out of memory space |
Posted: Tue Dec 16, 2003 9:09 am |
|
|
I'm currently using an 16f876a and am coming very close to running out of ROM. I've used every method I know to tweak (and many that I have found on this forum) and have one very large function which uses the atan, sin and cos functions in a calculation and thus uses alot of ROM space.
So, does anyone know of a better math library than the one supplied that does not use so much memory? I am not concerned about more than 5 decimal places.
I'm also considering spending some more money on the PCH compiler and going to the 18f252 which seems to be pin compatible with the 16f876a. It appears to me that my circuit would still work using the 18f252. Are there any problems or pitfalls software or hardware going in this upgrade direction?
Any other ideas would be greatly appreciated as well.
Thanks,
Bob |
|
|
Hans Wedemeyer
Joined: 15 Sep 2003 Posts: 226
|
|
Posted: Tue Dec 16, 2003 11:01 am |
|
|
If you are NOT using the Analog comparator function in the PIC16F876A then you should find not problem dropping in a PIC18F252 . |
|
|
bcs99
Joined: 22 Nov 2003 Posts: 32
|
|
Posted: Tue Dec 16, 2003 12:05 pm |
|
|
Thanks for the reply.
Would I have to make any coding changes if I changed to PCH using the 18F252 instead of 16F876A?
Bob |
|
|
Hans Wedemeyer
Joined: 15 Sep 2003 Posts: 226
|
|
Posted: Tue Dec 16, 2003 12:24 pm |
|
|
It depends on your code.
If you are using
#byte = address
Then you will need to adjust the address values.
Same goes for any defines that reefene memory or registers, the need to be updated for the PIC18 values. This takes just a few minutes, and some people make a .h file to handle all their own defines.
Interrupts default to what you are already used to in pic16F and should compile and work without problems.
Reading counters is faster, and for free.
I converted from PIC16F876 (not a) to PIC18F252 with a minimum of problems.
You can take advantage of the 4X PLL oscillator and get increased speed.
I don't know your xtal Freq. but if it's 10MHz and under you can simply enable the 4XPLL (FUSE H4 ) and get a 4X increase in speed. Remember to set the #use delay (to 4X of what you have now)
PCH has come of age, and is now a stable product (big smile and tongue in cheek). It's good. |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
|
Posted: Tue Dec 16, 2003 12:55 pm |
|
|
I believe that timer0 is now 16bit or 8bit so you might will probably need to keep that in mind and make sure that it is setup correctly. |
|
|
bcs99
Joined: 22 Nov 2003 Posts: 32
|
|
Posted: Wed Dec 17, 2003 5:42 pm |
|
|
Thanks for the tips. |
|
|
|