Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: float in interrupt function?

2005-04-09 by ed_hage

I also posted the question on the gnuarm group and there I got a good
tip. Apparently my startup code was not good; the globally defined
variables were defined but not properly initialised. So I initialised
it in main and then it worked!!

I try to get some info on startup-files, if anyone can point me in the
good direction your ore than welcome (web-links, books etc.)  

Greetings, Edward

--- In lpc2000@yahoogroups.com, "charlesgrenz" <charles.grenz@s...> wrote:
> 
> What's the assembly look like?
> 
> Charles
> 
> --- In lpc2000@yahoogroups.com, "ed_hage" <ed_hage@y...> wrote:
> > 
> > Thanks for the explanation.
> > 
> > I defined it as volatile and really it still does not work.
> > --------------------------------------------------
> > volatile unsigned long	DC0 = 10;
> > 
> > void IRQMotorOut (void)
> > {
> >   PWM_MR4 = (PWM_MR0 * DC0) / 100; 
> >   PWM_MR6 = (PWM_MR0 * 80)  / 100; 
> >   PWM_IR = PWM_RESET_MR0; //clear flag
> >   PWM_TCR = (1<<1);
> >   PWM_TCR = (1<<0); 
> >   VICVectAddr = 0;
> > }
> > -------------------------------------------------
> > MR6 works great, MR4 not. MR4 will work if I put DC0 =20 inside the
> > function, but like this its hopeless.I run out of ideas of what it
> > could be solved.
> > 
> > > 
> > > When ever you use a global variable, you have to specify it as a
> > > volatile to tell the compiler not to opitmize the variable out
of the
> > > equation when working with any ANSI C compiler.
> > > 
> > > Also by type casting the variable the same as the register you
want to
> > > use makes sure that the compiler is not going to do something funky
> > > when optimization is performed no matter what level.
> > > 
> > > regards,
> > > Charles
> > > 
> > > --- In lpc2000@yahoogroups.com, capiman@t... wrote:
> > > > The "volatile" is the thing, which makes it worth trying out...
> > > >

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.