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