Problems with long programs with PIC18F

Post your requests and ideas for the mikroElektronika website & forums.
Post Reply
Author
Message
uASM
Posts: 9
Joined: 16 Oct 2012 16:30

Problems with long programs with PIC18F

#1 Post by uASM » 16 Oct 2012 16:56

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!?!?

User avatar
janko.kaljevic
Posts: 3565
Joined: 16 Jun 2011 13:48

Re: Problems with long programs with PIC18F

#2 Post by janko.kaljevic » 17 Oct 2012 08:54

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.

uASM
Posts: 9
Joined: 16 Oct 2012 16:30

Re: Problems with long programs with PIC18F

#3 Post by uASM » 24 Oct 2012 18:59

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

User avatar
janko.kaljevic
Posts: 3565
Joined: 16 Jun 2011 13:48

Re: Problems with long programs with PIC18F

#4 Post by janko.kaljevic » 25 Oct 2012 15:53

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.

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: Problems with long programs with PIC18F

#5 Post by janni » 13 Nov 2012 14:48

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.
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.

Post Reply

Return to “Website & Forums Wishlist”