Hello,
I had the same problem, but I'm not bound to 16C55. In a newer stuff,
there is e.g.16C71x having particular bits can you give the answer.
However, there is another idea:
There are bits set definitely in a particular state upon power-up. Take
one of them, and set it to the opposite upon program entry. Then you can
check it, whether it is re-set by POR.
Imre
On Wed, 24 Jun 1998, Matthew J. Ancona wrote:
{Quote hidden}> Hello to the PIC List. Here's my problem. Any thoughts would be greatly
> appreciated.
>
> On a 16C55, I'd like to be able to distinguish between the first time the
> chip powers up and every other time it awakes from sleep.
>
> Only during the initial power up, I want to initialize some variables (used
> to count an external event). I do not want to re-initialize these
> variables every time the unit awakes from sleep. I should also say that
> the circuit is designed similar to the one in AN528, but uses a 55 instead
> of a 54. So I am using a low on the MCLR pin to cause a reset and awake
> the chip.
>
> The STATUS register has a couple of bits, PD and TO, dealing in this area,
> but I don't know if there is a logical combination that will give me what I
> need.
>
> If the 16C55 can't, is there another part that could? If the 16C55 can't
> using the STATUS reg, is there another simple way to solve this problem
> that is 100% foolproof. (I can envision checking a file register(s) to
> either allow or not the variable initialization routine. The problem I see
> is that on power-on, the contents of that register(s) is undefined and
> therefore could initially (1 out of 256) equal the value I would set it to,
> which nullifies its use. The odds improve by using multiple registers, 1
> out of 65536 for 2 regs, 1 out of 16.7 million for 3 regs, etc.)
>
> Another approach might be to add some latching hardware which would work,
> but would add cost and require PCB space.
>
>