View previous topic :: View next topic |
Author |
Message |
metalm
Joined: 22 Mar 2007 Posts: 23 Location: Buenos Aires, Argentina
|
Help: buffer size limited in PIC16 parts |
Posted: Tue Jul 31, 2007 12:36 pm |
|
|
Hello, this is the second time i have this problem:
I need to make a buffer as long as possible for keep received data to re-send this to another port with another baudrate and more.
The problem is that the buffer size is limited to 87 bytes (at least for PIC16F628 and PIC16F818).
I made a function MAIN with almost nothing in it (a for(;;);) to test if the compiller is not using ram for another thing, but it isn't
Now, if I increment the value of the "unsigned char BUFFER[87]" to 88 or more, the compillers gives an error: *** Error 74 ..... MC-140.c" Line 58(0,1): Not enough RAM for all variables
But if I keep this variable of 87 elements and i declare another variable of 20 elements more (unsigned char buffer2[20]), the compiller don't give errors anymore and the program is using more ram than if I have declared only buffer with 88 elements!!
How can I use all the ram I need? this pic has 128 bytes of ram.
thanks!!!!! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Jul 31, 2007 12:44 pm |
|
|
Quote: |
I need to make a buffer as long as possible for keep received data
to re-send this to another port with another baudrate and more.
The problem is that the buffer size is limited to 87 bytes (at least for
PIC16F628 and PIC16F818). |
See this post:
http://www.ccsinfo.com/forum/viewtopic.php?t=30456&start=4 |
|
|
metalm
Joined: 22 Mar 2007 Posts: 23 Location: Buenos Aires, Argentina
|
|
Posted: Tue Jul 31, 2007 12:47 pm |
|
|
Thank you very much! sorry for opening another post... |
|
|
metalm
Joined: 22 Mar 2007 Posts: 23 Location: Buenos Aires, Argentina
|
|
Posted: Tue Jul 31, 2007 1:06 pm |
|
|
In this pic, there is a block of 96 bytes, starting from 0x20 to 0x7F
When I want to #locate this buffer in 0x20, the compiller says to:
Line 18(1,5): Constant out of the valid range 077 is reserved by the compiler
|
|
|
metalm
Joined: 22 Mar 2007 Posts: 23 Location: Buenos Aires, Argentina
|
|
Posted: Wed Aug 01, 2007 12:59 pm |
|
|
Hello again, I saw that the compiller uses the direction 0x77 and 0x78 for the delay routines and for saving the "STATUS" register
Could I change that ???
thanks! |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Aug 01, 2007 1:52 pm |
|
|
In the 2nd to last post in this thread, it says that you can do it by
using the #locate directive. I tried it with PCM vs. 4.047 and I couldn't
make it work.
http://www.ccsinfo.com/forum/viewtopic.php?t=27996
Then in the CCS manual, it says you can change the default region
for variables by using the 'addressmod' and #type directives.
Again, I couldn't make it work. It may be something in the syntax
or the explanation in the manual that I don't understand. Or, it may be
that it's not implemented yet.
I suggest you contact CCS support and ask them how to relocate
scratch variables. |
|
|
metalm
Joined: 22 Mar 2007 Posts: 23 Location: Buenos Aires, Argentina
|
|
Posted: Wed Aug 01, 2007 2:29 pm |
|
|
Thank you!! |
|
|
|