TMR0 Pic 12F615

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 8.

Moderator: Benj

Post Reply
Corto
Posts: 28
Joined: Thu Sep 04, 2014 7:01 am
Has thanked: 7 times
Been thanked: 6 times
Contact:

TMR0 Pic 12F615

Post 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

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: TMR0 Pic 12F615

Post 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.

Corto
Posts: 28
Joined: Thu Sep 04, 2014 7:01 am
Has thanked: 7 times
Been thanked: 6 times
Contact:

Re: TMR0 Pic 12F615

Post 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

Post Reply