View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Oct 10, 2005 9:20 pm |
|
|
Quote: | it will only run for a small part and then restart the PIC |
Here are some tips:
Don't do anything weird.
1. Don't make large functions. Break them up into smaller ones.
2. Don't use "goto".
3. Don't use #asm code.
4. Don't use malloc.
5. Don't use #separate.
6. Don't use #org.
7. Don't use the Watchdog timer.
8. Don't use any special CCS function such as "goto_address()".
9. Don't try to exit from interrupt routines prematurely by
putting in some weird code.
10. Don't accidently write past the end of an array.
11. Don't try to use nested interrupts. i.e., Don't enable global
interrupts while still inside an interrupt routine. |
|
|
Foppie
Joined: 16 Sep 2005 Posts: 138 Location: The Netherlands
|
|
Posted: Tue Oct 11, 2005 12:36 am |
|
|
@PCM programmer: Thanks for your tips, here are my reaction to them:
PCM programmer wrote: | 1. Don't make large functions. Break them up into smaller ones. | I'm splitting p as much as possible, but if I insert a lot of small functions I still get the same problem.
PCM programmer wrote: | 2. Don't use "goto".
3. Don't use #asm code.
4. Don't use malloc.
5. Don't use #separate.
6. Don't use #org.
7. Don't use the Watchdog timer.
8. Don't use any special CCS function such as "goto_address()".
9. Don't try to exit from interrupt routines prematurely by putting in some weird code.
10. Don't accidently write past the end of an array. | I don't.
PCM programmer wrote: | 11. Don't try to use nested interrupts. i.e., Don't enable global interrupts while still inside an interrupt routine. | I only use 1 interrupt.
@Akira: which hardware/programmer do you use? I more and more get the feeling that it is a hardware problem.
I use the ClearView Mathias from TechTools |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Oct 11, 2005 7:28 pm |
|
|
Quote: | I more and more get the feeling that it is a hardware problem. |
It has been noted many times on here that the 16F877 "A" seems
flakier than the 16F877. Do you have 0.1 uF capacitors between
each Vdd pin and GND ? (and placed very close to the pins).
One test would be to replace the "A" chip with a "non A" chip.
See if it gets better.
Quote: | I use the ClearView Mathias from TechTools |
Have you actually ever run this program on a PIC chip, or has
all your development and testing been entirely on the ICE ?
If so, maybe you've got ICE problems. I would test it on
a real PIC. |
|
|
Foppie
Joined: 16 Sep 2005 Posts: 138 Location: The Netherlands
|
|
Posted: Wed Oct 12, 2005 12:58 am |
|
|
PCM programmer wrote: | It has been noted many times on here that the 16F877 "A" seems flakier than the 16F877. Do you have 0.1 uF capacitors between each Vdd pin and GND? (and placed very close to the pins). | They are in place.
PCM programmer wrote: | One test would be to replace the "A" chip with a "non A" chip. See if it gets better. | I'll do that asap!
PCM programmer wrote: | Quote: | I use the ClearView Mathias from TechTools | Have you actually ever run this program on a PIC chip, or has all your development and testing been entirely on the ICE? If so, maybe you've got ICE problems. I would test it on a real PIC. | I am waiting for a new hardware revision (coming end of this week) And then can switch to another programmer (ICD) to try and solve the problem. And if that doesn't work I'll program right on the PIC. |
|
|
Foppie
Joined: 16 Sep 2005 Posts: 138 Location: The Netherlands
|
|
Posted: Wed Oct 12, 2005 1:13 am |
|
|
PCM programmer wrote: | One test would be to replace the "A" chip with a "non A" chip. See if it gets better. | No change, still it doesn't work... |
|
|
Foppie
Joined: 16 Sep 2005 Posts: 138 Location: The Netherlands
|
|
Posted: Wed Oct 12, 2005 6:43 am |
|
|
Quote: | PCM programmer wrote: | Have you actually ever run this program on a PIC chip, or has all your development and testing been entirely on the ICE? If so, maybe you've got ICE problems. I would test it on a real PIC. | I am waiting for a new hardware revision (coming end of this week) And then can switch to another programmer (ICD) to try and solve the problem. And if that doesn't work I'll program right on the PIC. | It works!
Programming with a ICD-U solved all my problems. I got an unfinished prototype and if I compile all my code into it, it runs as it should do!
Many thanks! |
|
|
|