[En-Nut-Discussion] Hi resolution timer isr in assembler

en-nut-discussion-admin at egnite.de en-nut-discussion-admin at egnite.de
Sun Jun 22 13:50:55 CEST 2003


Hi Stephen.

Thanks for that hint. It works for C ISRs, I didn't try assembler for now.
But now I have another problem. It seems that the ISR forgets some of its
local variables. I defined them using

SIGNAL(SIG_OUTPUT_COMPARE2)
{
  static short x=0,y=0,p=0,m=0xff;
  static short mask=1,bits;
  ...

but e.g. the variable p forgets its content.

Why?

bye
Thorsten


----- Original Message -----
From: <en-nut-discussion-admin at egnite.de>
To: <en-nut-discussion at egnite.de>
Sent: Saturday, June 21, 2003 8:47 PM
Subject: Re: [En-Nut-Discussion] Hi resolution timer isr in assembler


> Hi Thorsten;
>
> This the exact same situation I ran into, although I stuck with C.
>
> First I setup the timer:
>
>  // set timer 2 to CTC mode, clock / 256 = 16uS
>  TCCR2 = BV(WGM21) | BV(CS22);
>  // Set output compare register to 30 = 480uS for now
>  OCR2 = 30;
>  // enable the output compare match interrupt
>  TIMSK |= BV(OCIE2);
>
> Then using AVR GCC, I setup the interrupt routine as :
>
> SIGNAL(SIG_OUTPUT_COMPARE2)
> {
>  // code here
> }
>
> As for then calling the assembly routine, I think a function call in the
> SIGNAL routine will work, although it has the extra indirection in there.
>
> Cheers
>
> Stephen Noftall
>
> ----- Original Message -----
> From: <en-nut-discussion-admin at egnite.de>
> To: <en-nut-discussion at egnite.de>
> Sent: Saturday, June 21, 2003 11:20 AM
> Subject: [En-Nut-Discussion] Hi resolution timer isr in assembler
>
>
> > Hi,
> >
> > for multiplexing a big LED panel I need a fast timer ISR that does that
> > task. I have written one in assembler but don't know how to hook it into
> the
> > main C program. Maybe someone has an example how to insert assembler
code
> > into C and how to hook it to the timer IRQ. There should be a
possibility
> to
> > use a 4kB array of characters defined in the C program with that
assembler
> > code or vice versa.
> >
> > Thank you
> > Thorsten
> >
> >
> > _______________________________________________
> > En-Nut-Discussion mailing list
> > En-Nut-Discussion at egnite.de
> > http://www.egnite.de/mailman/listinfo/en-nut-discussion
>
> _______________________________________________
> En-Nut-Discussion mailing list
> En-Nut-Discussion at egnite.de
> http://www.egnite.de/mailman/listinfo/en-nut-discussion
>




More information about the En-Nut-Discussion mailing list