Sign in

username:

password:



Not a member?

Search 68hc12



Search tips

Subscribe to 68hc12



68hc12 by Keywords

68HC1 | 812A4 | 9S12DP256 | Bootloader | CodeWarrior | D60A | Debugger | DP256 | ECT | EEPROM | EVB | Flash | HC1 | HCS12 | I2C | IAR | ICC1 | Interrupts | LCD | M68KIT912DP256 | MC9S12DP256 | MC9S12DP256B | Metrowerks | Motor | MSCAN | Multilink | PLL | Quadrature | SDI | SPI | Transceiver | XFC

Ads

Discussion Groups

See Also

DSPFPGAElectronics

Discussion Groups | 68HC12 | Forget interrupt?


Advertise Here

Join our technical discussions about Freescale Microcontrollers: M68HC12. (Freescale Semiconductor is a Subsidiary of Motorola).

Forget interrupt? - Pascal DEREX - Dec 8 11:43:34 2006

Hello,

I have an interrupt compare function on PT5 on 9s12a64. Here is the code :

void interrupt 13 it_OC5(void)
{

TFLG1=0x20;
TC5=TC5+time;
do something...

}

if time=30 then all the interrupts occur. But if time =15 sometimes there is no interrupt between 1 second!!
I specify that 60=1ms
How it could be possible? Could the micro forget interrupt?

Thank you for help

Regards

[Non-text portions of this message have been removed]


(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )


Re: Forget interrupt? - Edward Karpicz - Dec 8 12:40:22 2006

Pascal DEREX wrote:

> Hello,
>
> I have an interrupt compare function on PT5 on 9s12a64. Here is the code :
>
> void interrupt 13 it_OC5(void)
> {
>
> TFLG1=0x20;
> TC5=TC5+time;
> do something...
>
> }
>
> if time=30 then all the interrupts occur. But if time =15 sometimes there
> is no interrupt between 1 second!!
> I specify that 60=1ms
> How it could be possible? Could the micro forget interrupt?

"60 for 1ms" looks like big prescaler value, something like 7.68MHz bus and
max possible 1:128 prescaler, right? If so than "15" is 0.25ms and is quite
a lot and should be handled easily. Do you have something very long in TC5
or other interrupts? Could another part of your program clear by mistake TC5
flag? Are you using "fast flag clear"?

>
> Thank you for help
>
> Regards
>

Edward

______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.


(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )

Re: Forget interrupt? - Pascal - Dec 8 13:53:26 2006

Hello Edward,

I could have an interrupt during 0.1ms
I believed that if an interrupt occur the micro can not forget it. But with your answer i understand that if interrupt2 occurs when the micro is in the interrupt1 function, the micro could forget the interrupt2 when the interrupt1 is finished because TC5 is < TCNT and the end of interrupt1?

Thank you for help

Regards

----- Original Message -----
From: Edward Karpicz
To: 6...@yahoogroups.com
Sent: Friday, December 08, 2006 6:40 PM
Subject: Re: [68HC12] Forget interrupt?
Pascal DEREX wrote:

> Hello,
>
> I have an interrupt compare function on PT5 on 9s12a64. Here is the code :
>
> void interrupt 13 it_OC5(void)
> {
>
> TFLG1=0x20;
> TC5=TC5+time;
> do something...
>
> }
>
> if time=30 then all the interrupts occur. But if time =15 sometimes there
> is no interrupt between 1 second!!
> I specify that 60=1ms
> How it could be possible? Could the micro forget interrupt?

"60 for 1ms" looks like big prescaler value, something like 7.68MHz bus and
max possible 1:128 prescaler, right? If so than "15" is 0.25ms and is quite
a lot and should be handled easily. Do you have something very long in TC5
or other interrupts? Could another part of your program clear by mistake TC5
flag? Are you using "fast flag clear"?

>
> Thank you for help
>
> Regards
>

Edward

[Non-text portions of this message have been removed]


(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )

Re: Forget interrupt? - Pascal - Dec 8 14:31:03 2006

Hi again,

I found my mistake. I must do TC5=TCNT+time. Now all the it occurs at the "right" time

Regards

----- Original Message -----
From: Pascal
To: 6...@yahoogroups.com
Sent: Friday, December 08, 2006 7:47 PM
Subject: Re: [68HC12] Forget interrupt?
Hello Edward,

I could have an interrupt during 0.1ms
I believed that if an interrupt occur the micro can not forget it. But with your answer i understand that if interrupt2 occurs when the micro is in the interrupt1 function, the micro could forget the interrupt2 when the interrupt1 is finished because TC5 is < TCNT and the end of interrupt1?

Thank you for help

Regards

----- Original Message -----
From: Edward Karpicz
To: 6...@yahoogroups.com
Sent: Friday, December 08, 2006 6:40 PM
Subject: Re: [68HC12] Forget interrupt?

Pascal DEREX wrote:

> Hello,
>
> I have an interrupt compare function on PT5 on 9s12a64. Here is the code :
>
> void interrupt 13 it_OC5(void)
> {
>
> TFLG1=0x20;
> TC5=TC5+time;
> do something...
>
> }
>
> if time=30 then all the interrupts occur. But if time =15 sometimes there
> is no interrupt between 1 second!!
> I specify that 60=1ms
> How it could be possible? Could the micro forget interrupt?

"60 for 1ms" looks like big prescaler value, something like 7.68MHz bus and
max possible 1:128 prescaler, right? If so than "15" is 0.25ms and is quite
a lot and should be handled easily. Do you have something very long in TC5
or other interrupts? Could another part of your program clear by mistake TC5
flag? Are you using "fast flag clear"?

>
> Thank you for help
>
> Regards
>

Edward

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]


(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )

Re: Forget interrupt? - Edward Karpicz - Dec 8 14:43:52 2006

Pascal wrote:

> Hello Edward,
>
> I could have an interrupt during 0.1ms
> I believed that if an interrupt occur the micro can not forget it. But
> with your answer i understand that if interrupt2 occurs when the micro is
> in the interrupt1 function, the micro could forget the interrupt2 when the
> interrupt1 is finished because TC5 is < TCNT and the end of interrupt1?
>

You gave me a clue. No, ECT doesn't forget interrupts. ECT interrupt occurs
when TFLG flag gets set. If another interrupts takes longer than value you
add to TC5 (16.6us*15 in your case), then the next TC5 interrupt will occur
not 15 timer ticks but almost 2^16 ticks later. 2^16*16.6us gives about
1second. No wonder. Looks like you have too long interrupt latency.

Edward

> Thank you for help
>
> Regards
>
> ----- Original Message -----
> From: Edward Karpicz
> To: 6...@yahoogroups.com
> Sent: Friday, December 08, 2006 6:40 PM
> Subject: Re: [68HC12] Forget interrupt?
> Pascal DEREX wrote:
>
> > Hello,
> >
> > I have an interrupt compare function on PT5 on 9s12a64. Here is the
> code :
> >
> > void interrupt 13 it_OC5(void)
> > {
> >
> > TFLG1=0x20;
> > TC5=TC5+time;
> > do something...
> >
> > }
> >
> > if time=30 then all the interrupts occur. But if time =15 sometimes
> there
> > is no interrupt between 1 second!!
> > I specify that 60=1ms
> > How it could be possible? Could the micro forget interrupt?
>
> "60 for 1ms" looks like big prescaler value, something like 7.68MHz bus
> and
> max possible 1:128 prescaler, right? If so than "15" is 0.25ms and is
> quite
> a lot and should be handled easily. Do you have something very long in
> TC5
> or other interrupts? Could another part of your program clear by mistake
> TC5
> flag? Are you using "fast flag clear"?
>
> >
> > Thank you for help
> >
> > Regards
> > Edward
>
> [Non-text portions of this message have been removed]
> Yahoo! Groups Links



(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )

Re: Forget interrupt? - Edward Karpicz - Dec 8 16:01:11 2006

Sorry, forgot to explain why. Somehow I was thinking about my own projects
and simultaneously writing the reply.

E(0)--------N(15)--I(17)-----..---N'(65536+15)

Above is the scheme that I hope should explain why 1sec later and not 15
ticks. E(0) is moment when timer compare TCNT=TC5 succeeds and TFLG flag
flips from 0 to 1. N(15) is the next interrupt event that you hoped to occur
15ticks past the E(0). But other interrupts or something else delayed TC5
ISR I() so long, that when you write new value to TC5, it already is too
old, TCNT already has stepped through it. Interrupt will occur about 2^16
ticks later at N', when TCNT will reach the TCNT=15 again.
Do you really have so long interrupts latency, ~0.25ms ?

TC5=TCNT+N instead of TC5+=N of course helps, but only if you don't care
if output compare occurs always every N ticks or sometimes N+1 ticks,
sometimes N+m...

Edward

> Pascal wrote:
>
>> Hello Edward,
>>
>> I could have an interrupt during 0.1ms
>> I believed that if an interrupt occur the micro can not forget it. But
>> with your answer i understand that if interrupt2 occurs when the micro is
>> in the interrupt1 function, the micro could forget the interrupt2 when
>> the interrupt1 is finished because TC5 is < TCNT and the end of
>> interrupt1?
>> You gave me a clue. No, ECT doesn't forget interrupts. ECT interrupt
> occurs when TFLG flag gets set. If another interrupts takes longer than
> value you add to TC5 (16.6us*15 in your case), then the next TC5 interrupt
> will occur not 15 timer ticks but almost 2^16 ticks later. 2^16*16.6us
> gives about 1second. No wonder. Looks like you have too long interrupt
> latency.
>
> Edward
>
>> Thank you for help
>>
>> Regards
>>
>> ----- Original Message -----
>> From: Edward Karpicz
>> To: 6...@yahoogroups.com
>> Sent: Friday, December 08, 2006 6:40 PM
>> Subject: Re: [68HC12] Forget interrupt?
>> Pascal DEREX wrote:
>>
>> > Hello,
>> >
>> > I have an interrupt compare function on PT5 on 9s12a64. Here is the
>> code :
>> >
>> > void interrupt 13 it_OC5(void)
>> > {
>> >
>> > TFLG1=0x20;
>> > TC5=TC5+time;
>> > do something...
>> >
>> > }
>> >
>> > if time=30 then all the interrupts occur. But if time =15 sometimes
>> there
>> > is no interrupt between 1 second!!
>> > I specify that 60=1ms
>> > How it could be possible? Could the micro forget interrupt?
>>
>> "60 for 1ms" looks like big prescaler value, something like 7.68MHz bus
>> and
>> max possible 1:128 prescaler, right? If so than "15" is 0.25ms and is
>> quite
>> a lot and should be handled easily. Do you have something very long in
>> TC5
>> or other interrupts? Could another part of your program clear by mistake
>> TC5
>> flag? Are you using "fast flag clear"?
>>
>> >
>> > Thank you for help
>> >
>> > Regards
>> >
>>
>> Edward
>>
>> [Non-text portions of this message have been removed]
>> Yahoo! Groups Links
>>
>


(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )

Re: Forget interrupt? - Pascal DEREX - Dec 8 17:09:15 2006

thank you edward for your explanations.

Regards

----- Original Message -----
From: Edward Karpicz
To: 6...@yahoogroups.com
Sent: Friday, December 08, 2006 9:21 PM
Subject: Re: [68HC12] Forget interrupt?
Sorry, forgot to explain why. Somehow I was thinking about my own projects
and simultaneously writing the reply.

E(0)--------N(15)--I(17)-----..---N'(65536+15)

Above is the scheme that I hope should explain why 1sec later and not 15
ticks. E(0) is moment when timer compare TCNT=TC5 succeeds and TFLG flag
flips from 0 to 1. N(15) is the next interrupt event that you hoped to occur
15ticks past the E(0). But other interrupts or something else delayed TC5
ISR I() so long, that when you write new value to TC5, it already is too
old, TCNT already has stepped through it. Interrupt will occur about 2^16
ticks later at N', when TCNT will reach the TCNT=15 again.
Do you really have so long interrupts latency, ~0.25ms ?

TC5=TCNT+N instead of TC5+=N of course helps, but only if you don't care
if output compare occurs always every N ticks or sometimes N+1 ticks,
sometimes N+m...

Edward

> Pascal wrote:
>
>> Hello Edward,
>>
>> I could have an interrupt during 0.1ms
>> I believed that if an interrupt occur the micro can not forget it. But
>> with your answer i understand that if interrupt2 occurs when the micro is
>> in the interrupt1 function, the micro could forget the interrupt2 when
>> the interrupt1 is finished because TC5 is < TCNT and the end of
>> interrupt1?
>>
>
> You gave me a clue. No, ECT doesn't forget interrupts. ECT interrupt
> occurs when TFLG flag gets set. If another interrupts takes longer than
> value you add to TC5 (16.6us*15 in your case), then the next TC5 interrupt
> will occur not 15 timer ticks but almost 2^16 ticks later. 2^16*16.6us
> gives about 1second. No wonder. Looks like you have too long interrupt
> latency.
>
> Edward
>
>> Thank you for help
>>
>> Regards
>>
>> ----- Original Message -----
>> From: Edward Karpicz
>> To: 6...@yahoogroups.com
>> Sent: Friday, December 08, 2006 6:40 PM
>> Subject: Re: [68HC12] Forget interrupt?
>>
>>
>> Pascal DEREX wrote:
>>
>> > Hello,
>> >
>> > I have an interrupt compare function on PT5 on 9s12a64. Here is the
>> code :
>> >
>> > void interrupt 13 it_OC5(void)
>> > {
>> >
>> > TFLG1=0x20;
>> > TC5=TC5+time;
>> > do something...
>> >
>> > }
>> >
>> > if time=30 then all the interrupts occur. But if time =15 sometimes
>> there
>> > is no interrupt between 1 second!!
>> > I specify that 60=1ms
>> > How it could be possible? Could the micro forget interrupt?
>>
>> "60 for 1ms" looks like big prescaler value, something like 7.68MHz bus
>> and
>> max possible 1:128 prescaler, right? If so than "15" is 0.25ms and is
>> quite
>> a lot and should be handled easily. Do you have something very long in
>> TC5
>> or other interrupts? Could another part of your program clear by mistake
>> TC5
>> flag? Are you using "fast flag clear"?
>>
>> >
>> > Thank you for help
>> >
>> > Regards
>> >
>>
>> Edward
>>
>>
>>
>>
>>
>> [Non-text portions of this message have been removed]
>>
>>
>>
>>
>> Yahoo! Groups Links
>>
>>
>>
>>
>

[Non-text portions of this message have been removed]


(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )