Greetings,

I've written a program for the 16f88 which is behaving strangely in the circuit.

I have an initial loop which waits for a button press, the button press leaves the loop, then evaluates two other pins for high or low status (a two position switch is forcing one of the pins high, and the other low).

Depending on the status the program proceeds to a ten second timed section, or a ten minute timed section.


The behaviour is this: When power is initially applied, the pic jumps past the first wait. Even when I add a two second pause before entering the loop to evaluate the first button press.

It evaluates the two pins, and proceeds to the timed section. It is evaluating the two pins properly, and the timed sections run flawlessly.

When the timed section are complete, it goes back to the loop waiting for the start button.

Then the device operates properly.
Why would it skip the wait for button press loop on the first execution?

I have tied MCLR to vdd with a 10k resistor. I have a 10uF electrolytic smoothing out the supply which is from an lm7805 supplied by a high capacity 12v source. I have a 100nf cap between vdd and ground right at the pins.

The behaviour hasn't changed at all with these extra components in place.

I have some questions; If you state ansel = 0 does that mean the analog pins are now digital? I would like this to be the case.

I've heard that defining MCLR as an input is a mistake because you can't reprogram the pic properly thereafter. This could be the case. On the same token, I've heard that MCLR can't act as an output. So I don't know what I should do with this.

I'm using the internal oscillator.

Any Ideas? I am totally stumped, and it's for a product I'd like to demo for a group ASAP.

Mike