Page 1 of 1

TMR0 Pic 12F615

Posted: Wed May 08, 2019 4:14 am
by Corto
Hello Benj, Everyone,
I have a problem that I can not solve with the attached program, which was running Flowcode 7 I think or maybe 6 (I don't remember), whatever, it worked.
Lately I opened it under Flowcode 8.1.1.11 and compiled, since it doesn't works (in simulation under Proteus) the displayed error code is "Processor has been reset as a result of incorrect watchdog timer initialization"
however, I have initialized TMR0 = 0xff I do not understand where is the subtlety.
The operating principle is:
A2 is the IN input;
Input signal IN => a pulse that can vary from 1 to 2ms with a period of 20ms;
A3 is the output
Switch12F.fcfx
(10.68 KiB) Downloaded 219 times
if A2 = 1ms => A3 = 0; if A2 = 2ms => A3 = 1.

If you have an idea of the problem, I want some explanation to understand it.

Thank you in advance

Re: TMR0 Pic 12F615

Posted: Wed May 08, 2019 9:53 am
by Benj
Hello.

TMR0 = 0xFF; would put the timer count register so that it is about to overflow on the next increment of the counter.

However in the interrupt enable the timer clock is set to the T0CKI pin rather then the internal clock, is this correct?

The watchdog error could be that you have auto clear watchdog set in the project options but the watchdog timer is off in the configuration options.

Re: TMR0 Pic 12F615

Posted: Wed May 08, 2019 6:03 pm
by Corto
Thank you Benj,

TMR0=0xFF it is, as you said, to reset the counter to 0 when overflowing.
I tried without the C code and it's the same.
It is incredible because this program work before, and it seems to me correct!

The interrupt is on A2 (this is the external "clock" input, it is the signal of a servo motor control.
In Proteus, I can't set auto clear watchdog, I can only set a time
by default it is set to 1ms, I tried with 2ms and 20ms it is the same