Problems with long programs with PIC18F
Problems with long programs with PIC18F
Please help me, I am a PIC programer and usualy i program in assembler, but now i have a MicroC compiler with a USB Dongle License, and i program in C. I write a few litle programs and work well, but when i write large program, with for ex. 1500 lines, the code dont work well, no errors in compiler, but in the circuit dont work well, and if i change some line posicions on the editor the program may work well, or if i add some lines with code that never be executed in the runtime the circuits work well to. This dont make sense to me. I use a PIC18F2525 processor at 16Mhz. One friend of me have the same problem. Solutions please!?!?
- janko.kaljevic
- Posts: 3565
- Joined: 16 Jun 2011 13:48
Re: Problems with long programs with PIC18F
Hello,
From the post above I really can not locate what could be the problem.
If there is a example that can reproduce this issue, I am willing to take a look at.
So if you can, post here example that can demonstrate this behavior and some explanation how to detect it and reproduce it.
Best regards.
From the post above I really can not locate what could be the problem.
If there is a example that can reproduce this issue, I am willing to take a look at.
So if you can, post here example that can demonstrate this behavior and some explanation how to detect it and reproduce it.
Best regards.
Re: Problems with long programs with PIC18F
I send my new program, i have change many time the positions of the code for it works, and now it work ok until i a make a call to the module, then many functions works bad, the algorithm is not followed !!
Many such situations happen along the writing, and exchanging positions in the code editor program starts working well.
Now with this exemple, in edit project, if i check de Heap and put 1400 in the box, the programs work well.
Allso i do not know when I must activate HEAP and with wath SIZE?
thanks
Many such situations happen along the writing, and exchanging positions in the code editor program starts working well.
Now with this exemple, in edit project, if i check de Heap and put 1400 in the box, the programs work well.
Allso i do not know when I must activate HEAP and with wath SIZE?
thanks
- janko.kaljevic
- Posts: 3565
- Joined: 16 Jun 2011 13:48
Re: Problems with long programs with PIC18F
Hello,
Please can you tell me where did you send the code.
If it is more comfortable to you, submit the questioned project at our support desk:
http://www.mikroe.com/esupport/
Without project I really can not tell what could be the cause of this behavior.
Best regards.
Please can you tell me where did you send the code.
If it is more comfortable to you, submit the questioned project at our support desk:
http://www.mikroe.com/esupport/
Without project I really can not tell what could be the cause of this behavior.
Best regards.
Re: Problems with long programs with PIC18F
Problems like these frequently indicate errors in variables' declarations or pointers overreaching intended objects. The way the compiler works, small code changes may lead to completely different variables distribution in RAM and therefore errors in declarations may show up or vanish depending on apparently benign code changes. Please check for variables that are declared too small (too short strings, arrays, etc.) or pointers that reach farther than they should leading to overwriting of other variables directly following in RAM.uASM wrote:I write a few litle programs and work well, but when i write large program, with for ex. 1500 lines, the code dont work well, no errors in compiler, but in the circuit dont work well, and if i change some line posicions on the editor the program may work well, or if i add some lines with code that never be executed in the runtime the circuits work well to. This dont make sense to me.