Hi again Biswanath, At 08:22 AM 3/12/99 +0530, you wrote: >Thanks Sean -- Answer to your questions -- You are very welcome. I just hope we can solve your problem. I know someone here can. > >1) I'm using a prototyping kit which has a rectifier, 1000mfd, 5V regulator -- >and is supposed to take in AC. It has a jack which just fitted a small AC >adapter which I happened to have -- it produces 12V DC, no regulation -- so I >just plugged that in. Getting about 4.95V > >There may be a problem here -- with the power supply rise time as you have >mentioned. >How important is this & why ? No,it sounds as if your supply is pretty good. I'd just try adding a 10uF or so electrolytic cap and a 0.1uF ceramic cap directly between the PIC's Vdd and Vss pins. I think your supply should rise quickly and monotonically as it is. The problem with the supply not rising quickly and monotonically is this: when a PIC first receives power,it holds itself in reset for a short period of time (if the Power up start timer is enabled). If the power is not up to its full value by then,the PIC can begin running code in an unreliable manner or lock up. If the power doesn't rise steadily (i.e. it dips) during power up,then the PIC can enter a metastable state (it locks up and won't run code until the power is removed and re-applied). I must admit that I don't know the particular mechanisms by which this happens in a PIC,but I think the basic idea is that a PIC is a large sequential logic circuit. In order to work properly, certain registers (such as the PC) must get set to their startup values. If the power is not good enough,the mechanisms which are supposed to set these registers may not set them,or the registers may lose their contents after being set. > >2) I'm using a 2N2222A transistor -- emittor to gnd, 22K to base, 5.6K >collector to +5V, collector to Pic input. AC voltage is isolated from the mains >by a trafo which gives 22V, connected between 22K and gnd. This could possibly be the problem,although I can't offhand see why it shouldn't work O.K.. You should be able to do what you want by simply putting about a 220K resistor between the PIC pin and the output of the transformer. This will allow the PIC's protection diodes to clip the voltage with very minimal current flow. > >3) 470 ohms in series with each LED. > This sounds O.K,it would yield somewhere around 50mA max,less than the rating. >Hope this helps to understand the problem. > >Thanks to Mr. & Mrs Paul also for responding. > >Biswanath Dutta > Try what was suggested above and let us know what happens. Sean | | Sean Breheny | Amateur Radio Callsign: KA3YXM | Electrical Engineering Student \--------------=---------------- Save lives, please look at http://www.all.org Personal page: http://www.people.cornell.edu/pages/shb7 mailto:shb7@cornell.edu ICQ #: 3329174