Rob Zitka wrote: > Hi, > > I am having a problem with a protoype build of a PIC circuit. I have Port > B connected to 2 LED's (2 mA each), 3 relays (13 mA each) and 3 to an MAX > 232 chip. The chip is a 16C72, windowed. > > I wrote a simple program in MicroEngineering Labs PIC Basic to see test the > operation of the PIC. It goes as follows: > > High 0 > Pause 1000 > Low 0 > Pause 1000 > High 1 > Pause 1000 > Low 1 > Pause 1000 > > the rest goes on to do the same with the other lines conected to the relays. > > RB0 and RB1 operate the status LED's. I energize the circuit and the LED > connected to RB0 Blinks on one second then off. Then the LED connected to > RB1 doesn't light. Or sometimes the RB0 LED lights goes off then RB1 > lights and goes off. Most of the time though the RB1 LED never lights. > > Why is the operation of this so intermittent? > > I set Watchdog timer OFF during compilation. The MCLR is connected to a > DS1233 like Myke Predko recommends. The crystal is 4 MhZ, with 22pF loads. > The current draw on Port B is less than 50mA max. The circuit is powered > through a 5V regulator with a 9V battery. The relays have protection > diodes on the coils to prevent surge currents from damaging the PIC. The > PIC has a bypass cap at the Vdd and Vss. > > This has me stumped. I wish everyone who asked a question stated the circumstances as completely as this! The only two things I can think of, are : 1) Check whether the trisb register is guaranteed for output before you write to it. 2) Check if one of the delay variables aren't uninitialised. Because you use a JW part, the ambient light may affect the startup conditions of your RAM. I would also force the MCLR high during bug hunting. -- Friendly Regards Tjaart van der Walt mailto:tjaart@wasp.co.za |--------------------------------------------------| | WASP International | |R&D Engineer : GSM peripheral services development| |--------------------------------------------------| |SMS mailto: tjaart@sms.wasp.co.za (160 chars max)| | http://www.wasp.co.za/~tjaart/index.html | |Voice: +27-(0)11-622-8686 Fax: +27-(0)11-622-8973| | WGS-84 : 26¡10.52'S 28¡06.19'E | |--------------------------------------------------|