jpremor - 2007-11-28

Hi all,

im working at two projects one with pic 16fXXX family which is a small application (but big for the processor) and other with 18FXXJ60 which have ethernet hw.

I have finished the migration of free TCP/IP stack from microchip and im starting to test it.
(when done i can open my code here).
As said at my post before, i was experimenting some strange problems with variables in ram. The problem was solved changing the declaration from
"unsigned char Pagina[20][4]" to "unsigned int Pagina[20][4]"
dont ask me why, but now the modbus variables is not overwriting. Maybe it is working while im not adding mode variables.

Looking at 16F manual item, i found some recomendations like this:

"For devices that have multiple code pages it is more efficient to use the same number of files as pages: Use up to 4 separate .c files for the 16F877, but only 2 files for the 16F874. This way the linker can put the code for each file into different code pages and there will be less page selection overhead. "

Thats ok, no problem, but i was using at least 7 or 8 .c separated files where the recommended is 2 (according to the memory size). Some of them have new global variables declaration, can this be a problem?
At 16F project, i was experimenting some problems in RAM to Some variables sometimes is correct sometimes is wrong.
After change my project to just 1 file first some program space errors was generated like expected.
Separating in two files it is compiled and working fine (no more errors in variables). But the program is so ugly there is two files with 700 lines. Very dificult to read.

My first question is:
1) It is possible to use more files and set the memory bank? Something like - this function at bank 1 this at bank 2...

2) With separated files, where i should put the global variables? all them together in one .c and extern declarations in the others? (maybe a nb question, hehee)

3) For 18F family (128k flash), there is the same problem? I dont find any recomendation like this in the manual. Just for TCP stack im using a lot .c files, aprox. 15 files, like microchip.
About this, how can i organize the 18F project?

thanks a lot!