Timer Interrupt in Makro
Moderator: Benj
-
- Posts: 116
- Joined: Wed Feb 08, 2012 2:45 pm
- Has thanked: 7 times
- Been thanked: 11 times
- Contact:
Timer Interrupt in Makro
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
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
-
- 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
Hi Dirk,
instead of changing to: if timer0 for example:
If that's not it then can you post your flowchart so we can take a look at what could bo going on.
Martin
Thanks Dirk and the same to youDirkB wrote: merry christmas at first ;o)
This can occur if in the interrupt properties the clock source select are left on the defaultDirkB wrote:In simulation it works well but it doesn't work on chip.
Code: Select all
Transistion on T0CKI
Code: Select all
Internal clock (CLKO)
Martin
Martin
-
- Posts: 116
- Joined: Wed Feb 08, 2012 2:45 pm
- Has thanked: 7 times
- Been thanked: 11 times
- Contact:
Re: Timer Interrupt in Makro
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
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
-
- 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
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 as explained in the link you posted?
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);
Martin
-
- Posts: 116
- Joined: Wed Feb 08, 2012 2:45 pm
- Has thanked: 7 times
- Been thanked: 11 times
- Contact:
Re: Timer Interrupt in Makro
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
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
-
- 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
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
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
-
- Posts: 116
- Joined: Wed Feb 08, 2012 2:45 pm
- Has thanked: 7 times
- Been thanked: 11 times
- Contact:
Re: Timer Interrupt in Makro
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
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
-
- 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
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
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
-
- Posts: 116
- Joined: Wed Feb 08, 2012 2:45 pm
- Has thanked: 7 times
- Been thanked: 11 times
- Contact:
Re: Timer Interrupt in Makro
Hi martin,
my flowchart only is for testing. Tomorrow I will try another PIC
and see what happen and will inform you.
Dirk
my flowchart only is for testing. Tomorrow I will try another PIC
and see what happen and will inform you.
Dirk
-
- Matrix Staff
- Posts: 9520
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
- Contact:
-
- Posts: 116
- Joined: Wed Feb 08, 2012 2:45 pm
- Has thanked: 7 times
- Been thanked: 11 times
- Contact:
Re: Timer Interrupt in Makro
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.
How to work with it, and will that resolve my problem?
Dirk
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.
Dirk
- 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
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.
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.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 116
- Joined: Wed Feb 08, 2012 2:45 pm
- Has thanked: 7 times
- Been thanked: 11 times
- Contact:
Re: Timer Interrupt in Makro
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
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
-
- Posts: 116
- Joined: Wed Feb 08, 2012 2:45 pm
- Has thanked: 7 times
- Been thanked: 11 times
- Contact:
Re: Timer Interrupt in Makro
Hello,
and i have learned must enable timer only one time outside flowchart!
thanks
Dirk
and i have learned must enable timer only one time outside flowchart!
thanks
Dirk