Erratic timer operation

A forums to allow bugs and problems with Flowcode v7 to be reported and resolved.

Moderator: Benj

Post Reply
howard123
Posts: 75
Joined: Thu May 24, 2012 1:15 pm
Location: Cape Town
Has thanked: 30 times
Been thanked: 28 times
Contact:

Erratic timer operation

Post by howard123 »

Hello all

I am having a problem with the timers on a PIC16F18854 in that there is an irregular behavior in the servicing of the associated ISR. This manifests as the ISR running sometimes as normal, sometimes as irregular and sometimes as not running at all. When it does run, the ISR is at the correct point in time, if this makes sense.

This is demonstrated in the ISR as output B2 and in the main loop as output B0.

I have associated this variable behavior as being a function of some minor things being placed in the main loop, as shown in my example. I have tested both TMR0 and TMR1 to have this condition and am guessing that the other timers might be affected in a similar way.

Many thanks
Howard
FC7.3.0.5 (the problem existed before this update)
Attachments
Timer test.fcfx
(10.56 KiB) Downloaded 217 times

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: Erratic timer operation

Post by Benj »

Hi Howard,

Hmm that's a strange one. B2 seems to work ok driven by the timer interrupt but B0 doesn't light up at all for me.

Looks like the problem lies in the TickGlobal macro and when the timer interrupt fires. If the timer fires just before the decision instruction in TickGlobal then B0 should light but it looks like we are regularly missing this window.

What specifically are you trying to do? maybe there is a better way.

howard123
Posts: 75
Joined: Thu May 24, 2012 1:15 pm
Location: Cape Town
Has thanked: 30 times
Been thanked: 28 times
Contact:

Re: Erratic timer operation

Post by howard123 »

Hi Ben

The code in main is mostly illustrative and not necessarily needed. I have subsequently made a main loop counter to derive time for this application and that is working fine so timers are no longer required.

On my hardware, the output within the IRS (B2) is erratic and is related in some way to the code in main. I have seen this on more than one prototype board.

Thanks this is resolved for me but may be useful for others to be made aware of this chip's timers.

regards
Howard

Kenrix2
Flowcode v5 User
Posts: 211
Joined: Tue Feb 19, 2013 9:51 pm
Has thanked: 72 times
Been thanked: 177 times
Contact:

Re: Erratic timer operation

Post by Kenrix2 »

There is nothing wrong with the chip's timers. This is a Flowcode bug.

Post Reply