Author |
Message |
Topic: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
terryopie
Replies: 28
Views: 44674
|
Forum: General CCS C Discussion Posted: Tue Nov 24, 2015 7:52 am Subject: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
Unfortunately 'comprehensive' change data is something that CCS are poor at. They release a compiler, with a 'one line' change detail, and only after using it, does it become obvious that they have ac ... |
Topic: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
terryopie
Replies: 28
Views: 44674
|
Forum: General CCS C Discussion Posted: Tue Nov 24, 2015 7:44 am Subject: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
Is that an elevator controller project
Yes. Yes it is. :D |
Topic: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
terryopie
Replies: 28
Views: 44674
|
Forum: General CCS C Discussion Posted: Mon Nov 23, 2015 4:12 pm Subject: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
Well... I did get someone with v5.033 of the CCS Compiler to compile the questionable code for me. The problem went away and the assembly looks fine.
So, I think I can chalk this up to a compiler ... |
Topic: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
terryopie
Replies: 28
Views: 44674
|
Forum: General CCS C Discussion Posted: Mon Nov 23, 2015 11:17 am Subject: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
Instead of 4.135 do you have 4.141 to try?
Unfortunately I don't... :(
I tried to find a change log for the 4.xxx compilers but I could only find it for the 5.xxx compilers. Do you know of som ... |
Topic: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
terryopie
Replies: 28
Views: 44674
|
Forum: General CCS C Discussion Posted: Mon Nov 23, 2015 10:59 am Subject: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
Try this:
Isolate other cases, then have a default: case that covers your existing case 1, 5, 7, 11, 12.
Just tried that and that also had issues... the GOTO (to the same address) moved to an ... |
Topic: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
terryopie
Replies: 28
Views: 44674
|
Forum: General CCS C Discussion Posted: Mon Nov 23, 2015 10:36 am Subject: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
I had neglected to mention it, but I did change the order of a few of the functions with no change.
But again, pulling at straws and digging through assembly in the lst file, I found this:
04D0C ... |
Topic: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
terryopie
Replies: 28
Views: 44674
|
Forum: General CCS C Discussion Posted: Mon Nov 23, 2015 10:09 am Subject: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
I have updated the inline assembly to follow the listing in the data sheet:
#ASM
MOVF _a_lo,W ; Set-up address to write to
MOVWF EEADR
MOVF _a_hi,W
MOVWF ... |
Topic: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
terryopie
Replies: 28
Views: 44674
|
Forum: General CCS C Discussion Posted: Mon Nov 16, 2015 10:36 am Subject: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
I suspect that you are putting a RETURN instruction in the ASM code,
instead of letting the compiler handle the return by letting the function
proceed to the closing brace. Maybe you are not doing ... |
Topic: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
terryopie
Replies: 28
Views: 44674
|
Forum: General CCS C Discussion Posted: Mon Nov 16, 2015 10:11 am Subject: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
Here is the Assembly:
#ASM
MOVF _a_lo,W ; Set-up address to write to
MOVWF EEADR
MOVF _a_hi,W
MOVWF EEADRH
MOVF _a_ ... |
Topic: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
terryopie
Replies: 28
Views: 44674
|
Forum: General CCS C Discussion Posted: Mon Nov 16, 2015 9:28 am Subject: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
_Underflow_. Very interesting.
Somehow you are executing a return from something that is not actually called, or popping a value from the stack.
Does the code use function pointers?. Classic is ... |
Topic: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
terryopie
Replies: 28
Views: 44674
|
Forum: General CCS C Discussion Posted: Mon Nov 16, 2015 7:44 am Subject: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
On the reset_cause, _you_ have to test for stack over/underflow. The bits for this are not part of RCON register, which is what 'restart_cause' actually reflects. With STVREN enabled, if you add:
... |
Topic: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
terryopie
Replies: 28
Views: 44674
|
Forum: General CCS C Discussion Posted: Fri Nov 13, 2015 10:58 am Subject: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
First thing why have you got NOSTVREN selected?. STVREN, is one that should always be selected, unless you add your own code to monitor the stack. I'd possibly not be surprised if you enabled this, th ... |
Topic: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
terryopie
Replies: 28
Views: 44674
|
Forum: General CCS C Discussion Posted: Fri Nov 13, 2015 8:46 am Subject: SOLVED/Kinda - Random Resets with reason of MCLR_FROM_RUN... |
For reference I am using the following:
Compiler: PCWHD v4.135
Chip: PIC18F66K80
Memory usage: ROM=86% RAM=37% - 39%
FUSES:
#FUSES VREGSLEEP_SW,INTRC_HP,SOSC_DIG,HSM,PLLEN,NOF ... |
|