Timer Interrupt in Makro

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
DirkB
Posts: 116
Joined: Wed Feb 08, 2012 2:45 pm
Has thanked: 7 times
Been thanked: 11 times
Contact:

Timer Interrupt in Makro

Post by DirkB »

Hello, merry christmas at first ;o)

Timer interrupt in makro doesn't works. I am using 12F1840.
In simulation it works well but it doesn't work on chip.
Is it possible to use timer interrupt in makro?

thanks

Dirk

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Timer Interrupt in Makro

Post by medelec35 »

Hi Dirk,
DirkB wrote: merry christmas at first ;o)
Thanks Dirk and the same to you :)
DirkB wrote:In simulation it works well but it doesn't work on chip.
This can occur if in the interrupt properties the clock source select are left on the default

Code: Select all

Transistion on T0CKI
instead of changing to:

Code: Select all

 Internal clock (CLKO)
if timer0 for example:
timer int.png
(26.57 KiB) Downloaded 6338 times
If that's not it then can you post your flowchart so we can take a look at what could bo going on.

Martin
Martin

DirkB
Posts: 116
Joined: Wed Feb 08, 2012 2:45 pm
Has thanked: 7 times
Been thanked: 11 times
Contact:

Re: Timer Interrupt in Makro

Post by DirkB »

Hi Martin,

clock source is configured to internal clock. A simple flowchart (only lights LED)
doesn't works in makro, only in main flowchart. is this (maybe) a bug?

http://www.matrixtsl.com/mmforums/viewt ... upt#p60278

thanks

Dirk

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Timer Interrupt in Makro

Post by medelec35 »

So the timer interrupt works, but not the port bits.
If you post your flowchart (or PM if confidential or commercially sensitive) I will see if I can sort it out for you.
I assumed you have tried a c code block with

Code: Select all

clear_bit(t1con,T1OSCEN);
as explained in the link you posted?
Martin

DirkB
Posts: 116
Joined: Wed Feb 08, 2012 2:45 pm
Has thanked: 7 times
Been thanked: 11 times
Contact:

Re: Timer Interrupt in Makro

Post by DirkB »

Hi Martin,

you are right. Interrupt works, but port bits doesn't work. The problem is, port bit works fine without
ADC in flowchart. If activated component ADC in flowchart port bits doesn't works !??
Same problem in Fc5 and FC6! Any idea?

thanks

Dirk
Attachments
Makro_Timer_Test_v6.fcfx
FC6
(8.2 KiB) Downloaded 311 times
Makro_Timer_Test.fcf
FC5
(16 KiB) Downloaded 357 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Timer Interrupt in Makro

Post by medelec35 »

Hi Dirk,
I believe the issue is with your flowchart rather than a Flwocode bug.
I have just put together a very crude flowchart to show that pot and RA5 works just fine together.

Martin
Attachments
Makro_Timer_Test 2.fcf
(16 KiB) Downloaded 391 times
Martin

DirkB
Posts: 116
Joined: Wed Feb 08, 2012 2:45 pm
Has thanked: 7 times
Been thanked: 11 times
Contact:

Re: Timer Interrupt in Makro

Post by DirkB »

Hello Martin,

do you have seen attached flowcharts? Problem is that timer works and flashing LED,
only adding adc in flowchart adc works fine, but timer doesn't works. Deactivating adc
and timer works again. Is it (maybe) a bug in 12F1840 file?

thanks

Dirk

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Timer Interrupt in Makro

Post by medelec35 »

Hi Dirk,
The attached flowchart on my above post uses both timer 0 interrupt and ADC & works on hardware.
AN1 just alters the speed of the flashing LED connected to RA5.
It looks like issue is with the way you have created your flowchart, And value for ADC just affects the timing by a very short amount you cant see LED Flash duration change.

If you let be know what you want hardware to do, I can see if i can modify your flowchart to suit.

Martin
Martin

DirkB
Posts: 116
Joined: Wed Feb 08, 2012 2:45 pm
Has thanked: 7 times
Been thanked: 11 times
Contact:

Re: Timer Interrupt in Makro

Post by DirkB »

Hi martin,

my flowchart only is for testing. Tomorrow I will try another PIC
and see what happen and will inform you.


Dirk

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: Timer Interrupt in Makro

Post by medelec35 »

No problem,
I tried my flowchart on the 12F1840.


Martin
Martin

DirkB
Posts: 116
Joined: Wed Feb 08, 2012 2:45 pm
Has thanked: 7 times
Been thanked: 11 times
Contact:

Re: Timer Interrupt in Makro

Post by DirkB »

Hi Martin,

it seems problem is, i need timer in loop for continuous count.
Or is it possible to count in other way?


(Update)

The continuous reading of ADC decreases clock. This maybe the problem. ADC generates interrupt.

Code: Select all

16.1.5 INTERRUPTS
The ADC module allows for the ability to generate an interrupt upon completion of an Analog-to-Digital conversion. The ADC Interrupt Flag is the ADIF bit in the PIR1 register. The ADC Interrupt Enable is the ADIE bit in the PIE1 register. The ADIF bit must be cleared in software.
This interrupt can be generated while the device is operating or while in Sleep. If the device is in Sleep, the interrupt will wake-up the device. Upon waking from Sleep, the next instruction following the SLEEP instruc- tion is always executed. If the user is attempting to wake-up from Sleep and resume in-line code execu- tion, the GIE and PEIE bits of the INTCON register must be disabled. If the GIE and PEIE bits of the INTCON register are enabled, execution will switch to the Interrupt Service Routine.
How to work with it, and will that resolve my problem?


Dirk

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: Timer Interrupt in Makro

Post by Benj »

Hello Dirk,

The custom interrupts allow for this type of functionality.

Use the device datasheet and the info from this wiki page to create your custom interrupt.

http://www.matrixtsl.com/wiki/index.php ... -_PICmicro

If you get stuck then post what you have so far and we will try to help.

DirkB
Posts: 116
Joined: Wed Feb 08, 2012 2:45 pm
Has thanked: 7 times
Been thanked: 11 times
Contact:

Re: Timer Interrupt in Makro

Post by DirkB »

Hello,

found my problem in decision. Entry was (var = xxx?) and need a little bit too much
precision. this precision was missing with ADC in flowchart.
changing entry to (var >= xxx? or var <= xxx?). now all works fine.

thanks

Dirk

DirkB
Posts: 116
Joined: Wed Feb 08, 2012 2:45 pm
Has thanked: 7 times
Been thanked: 11 times
Contact:

Re: Timer Interrupt in Makro

Post by DirkB »

Hello,

and i have learned must enable timer only one time outside flowchart! :mrgreen:

thanks

Dirk

Post Reply