I will start by making the assumption that you have optoisolated the outputs, pic to the contactors. (If not then, do so.) Run the pic on batteries to make sure that the problem is not in the supply. If ok on the batteries then, you have to work on the supply, use a snubber, make sure the output cap is large enough to prevent brown out. Put ferrite beads in all the pic's I/Os and the PS leads. lastly, keep your job and ask for a raise;) Good luck. Carl Watley WB2ZSG writes: >---------- >> From: >> To: piclist >> Subject: Fw: Intermittent Problems >> Date: 05 April 1997 22:29 >> >> >> >> ---------- >> > From: John Waterman >> > To: piclist >> > Subject: Intermittent Problems >> > Date: 05 April 1997 19:45 >> > >> > I am a newcomer to PICs and have been having problems with my >first >> > project. I am using a 16C84 with Port A as all inputs and Port B >as all >> > outputs. Initially the PIC was just controlling LEDs, and although >it >> > worked fine most of the time, occasionally an output would come on >for >no >> > apparent reason. The only interrupt I am using is the RTCC >overflow one >> and >> > I take the precaution of saving W and STATUS at the beginning of >the >> > interrupt routine and restoring them at the end. >> > >> > I carried on with the project and connected the outputs to solid >state >> > relays which in turn control contactors using 110volt a.c. coils. >> Whenever >> > the 110volts was turned on the problem became considerably worse. >I >then >> > discovered that by replacing a sequence such as >> > >> > BCF PORTB,0 >> > BSF PORTB,1 >> > with >> > MOVLW 2 >> > MOVWF PORTB >> > the problem decreased dramatically. >> > >> > I have a subroutine which redefines the TRISs and OPTION, and I >call >this >> > before virtually all I/O read or writes as recommended in the data >sheet >> > for a noisy environment. I also discovered that by putting a delay >of >> > around 50mS at the end of this subroutine the program then became >> virtually >> > trouble free. An occasional problem would occur at just one part >of the >> > cycle, but this was 'side-stepped' by changing the sequence of >events >and >> > then everything appeared to be fine. >> > >> > I carried on further, and connected the outputs from the >contactors to >> > 415volt 3phase >> > motors, and with these motors running under no load conditions >everything >> > still appeared to be fine, although testing at this stage was >rather >> > limited. When however the machine was put on load, problems >returned. >> > Sometimes it will work fine but at other times it will go wrong in >an >> > unpredictable manner. I have put varistors across the 110volt >coils but >> > with little or no effect. The PIC is inside a metal box maybe >around >10cm >> > from the nearest contactor and all the input cables are screened - >what >> > more can I do? >> > >> > Please help or I think I may soon be looking for another job! >> > >> > John Waterman >