At 11:03 PM 1/06/98 -0300, you wrote: >Hi Dennis - thanks for the reply. I've clarified a few things below as I >wasn't too clear in my first posting - > >> >>Hi Lewis >> > the batteries are in series, and are currently being replaced >>(Old one in while a new one in the other location is being inserted), then >>the old cell should have a high enough impedance to not provide enough >>current to run the circuit. When the older battery is removed, the power >>will go and the PIC will enter a reset state when the new battery is >inserted. > >The batteries are in series in the holder so that you get a full 6V (6.3 >open circuit) on the terminals of the holder. The sequence that I have >some concerns about is as follows; >1) The battery holder is empty - no batteries are installed. >2) User slips in the first coin cell - the holder now has only one battery, >the voltage on the terminals of the holder (and thus the micro) is 3.0V. >3) The user installs the second battery - the holder now has two batteries >in series and has 6 volts on the terminals of the holder - and thus the micro. > >It's the period of time between 2) and 3) that I am wondering about - i.e. >am I going to cause "funny business" with the micro and then when the >second cell is installed, the micro has gone "south" on me or something >like that. > >The code is being written so that it sets up everything and then goes to >sleep when powered up. When it awakes (via the change on port B) it does >it's main task as long as the button is held down by the operator - then >when the button is released - it goes to sleep again. > > > >>Things to look out for:- >> >>1/ CMOS latch up, ensure that the PIC is not attempting to drive high >>capacitive or inductive loads during the power up phase > >No problem here - in fact, all other "circuits" are being powered by the >port pins on the PIC and therefore won't be fired up until the micro does >it in the main task code. > > > >>2/ Check the operating range of the PIC, some will operate down to 2.5V > >I want to use the '620 series but the F84 is also on the plate for usage as >well. From the spec sheets it's 4-6V for the Vdd on the F84- I'm running >them at 4MHz. The '620 looks better in that it specs a Vdd down to 3V - >this would quell any concerns about powering up the micro with one lithium >cell for a brief time before the second one was loaded into the holder... > >>3/ On power up (Check the status bits) DON'T trust the reset circuits >>to fully enable all the on board stuff. i.e. Do your own resetting! > >Not sure what you mean by this. I'm new to PICs - is there a bit in the >status register to check for a power-up condition? *grabbing for the data >book as I type this :) > > >>4/ Don't trust the on board RAM, i.e. The RAMS contents may be corrupted >> > >No problem here - there's only a handful of bytes and they are all loaded >with counter values etc. each time the routines use them... > > >>The last two are very important, if the PIC loses power, then the internal >>reset (Not like some other micros) only resets the internal stuff and >>attempts to set the oscillator is running. The RAM may have had data written >>any where, so be ready for this. > >Thanks for the tips - will keep this in mind. > >>On the oscillator, if you are having problems choosing the correct C and R >>(For Xtal) then look at using an RC, these are cheep, start faster and if >>designed correctly use less power for the same frequency (Up to 500KHz), >>note that this excludes the 32KHz stuff > >I want to bit-bang a port bit for a serial data stream coming out of the >micro - no receiver - just transmit. Was thinking of the ceramic >oscillator approach here - cheaper than xtals but more accurate than RC - >will be fixed at 4800 baud... > > > >> >>For a last piece of advice (Standard thing that I give to all people using >>battery powered stuff) Always ensure that the internal stuff and the TRIS >>registers are constantly re enabled. > >Duly noted - thanks for assistance! > > OK all seems good! Normaly there is no problem when running on batteries, as the battery can be considered "Brown out free". During insertion the rise time for VDD is fast, however if it is below the minimum level (4V) then the chip will not exit reset correctly (OSC may not startup, thats generaly the only thing. In this case putting in the other battery will kick start the OSC, note that the on board stuff may not be reset correctly). Now what can you do about this? 1/ Nothing, as the thing will go when the new batteries are in (Follow the above and all should be OK) 2/ Enable the watchdog, this will issue resets until the "cows come home" if the PIC is not running. This will always draw power and will "Wake up" the sleeping processor (Not very nice, but is handy in some projects) 3/ Use an external reset type chip Seiko make some nice ones here that draw nanoamps! At a cost of around 18 cents in quanty. Dennis -=====================================================================- Dennis Plunkett: Embedded Hardware, Software design NEC Australia DRMASS ph 03 9264-3867 -=====================================================================-