View previous topic :: View next topic |
Author |
Message |
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
We need to see the code to help! |
Posted: Sat Apr 17, 2004 10:16 am |
|
|
It would be helpful for those of us who are not mind readers to see the code and then we might be able to help you..... |
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
|
Posted: Sat Apr 17, 2004 11:06 am |
|
|
What is attached to the reset pin and do you use a powerup timer? |
|
|
Gabriel Caffese
Joined: 09 Oct 2003 Posts: 39 Location: LA PLATA, ARGENTINA
|
And the hardware... |
Posted: Sat Apr 17, 2004 11:10 am |
|
|
Hackam,
It would also be important to see the schematic.
It may be hardware reason why the micro gets reseted. |
|
|
Sergio
Joined: 16 Oct 2003 Posts: 11 Location: Arkansas, USA
|
|
Posted: Sat Apr 17, 2004 10:30 pm |
|
|
Is this a new or existing product?
Has it ever worked correctly?
When did it start having this problem?
What do you mean "skips code lines"? _________________ Sergio |
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
|
Posted: Sun Apr 18, 2004 8:28 am |
|
|
You might try a flyback diode acros the relay. Turning a coil off will cause a voltage spike. |
|
|
rwyoung
Joined: 12 Nov 2003 Posts: 563 Location: Lawrence, KS USA
|
|
Posted: Sun Apr 18, 2004 9:31 am |
|
|
1) Enable the power-up timer in your FUSE statements, "PUT" I believe is the correct flag.
2) Beg, borrow or steal a digital oscilloscope with at least 20MHz of glitch-capture bandwidth and monitor the VCC line right at the PIC during power up. If you have a dual-channel unit, put CH1 on the VCC pin set for AC coupling and maybe 100mV/div. Use CH2 as your trigger source and set it up to capture the rise of VCC as it comes out of your power supply. Look for glitches, anomolies or invalid rise-times on the power supply rail.
3) Sufficient by-pass capacitors on VCC? Minimum would probably be 0.1uF per PIC VCC pin plus 10uF to 100uF bulk capacitance near PIC.
4) Spagetti gounds or nice neat ground configuration or ground plane?
5) Diodes across relay coils so collapsing magnetic field doesn't disturb VCC?
6) I didn't see you spending time in the main() to configure the PIC so either you just left that out of the listing you posted or you are relying on the default settings of the PIC after power up. You may be lucky and all the default settings are appropriate. Personally, I usually have a subroutine called InitPIC() that is called right away in main() and there I configure all the pins, timers, ADC, etc as I will expect them to operate later in my program.
Based on your descriptions it sounds like a problem with the VCC line having glitches on it as it rises to a valid level. And it could be layers of problems. You might want to consider using a reset IC from the MCP120 or MCP130 families to hold the PIC in reset until well after the power has stabilized. _________________ Rob Young
The Screw-Up Fairy may just visit you but he has crashed on my couch for the last month! |
|
|
Gabriel Caffese
Joined: 09 Oct 2003 Posts: 39 Location: LA PLATA, ARGENTINA
|
It has to be electrical....... |
Posted: Sun Apr 18, 2004 9:36 am |
|
|
Hakam,
If the micro hangs up when you connect it to the mains, nearly SURE it has to be some kind of electrical problem:
1) Check your VDD source.
2) Have you put a .1uf cap between VDD and GND, close to the PIC ?
3) Does it feed the circuit with enough current ? If not, VDD will go down.
Gabriel.- |
|
|
SteveS
Joined: 27 Oct 2003 Posts: 126
|
|
Posted: Mon Apr 19, 2004 7:06 am |
|
|
You are in a really tough environment for a micro. You have motors and relays which put out a lot of emmissions - on the lines and coupled through magnetic and electrical fields. You need to isolate and shield.
A few particulars:
- decouple your micro from the relays. As mentioned use a flyback diode at a minimum. I would look at opto-isolation.
- decouple the power supply with ferrites and capacitors.
- the board must be tightly laid out with good ground plane with attention paid to high current vs low current supplied and returns. Think about where the current flows.
- try your LED test board physically in the area where the final board will be and run the washer 'manually'. Does that board still work correctly? |
|
|
|