> >The only thing that I can not get done is to use a global variable to
> >multiply (the global is being updated by other functions like
> >controller-function).
> >
> >I changed to the following but it still does not work:
> >
> >//global
> >int DC1 = 80; // 80%
> >
> >void IRQMotorOut (void)
> >{
> > PWM_MR4 = PWM_MR0 / 100;
> > PWM_MR4 *= DC1; // 0<DC1<100 [%]
> > PWM_IR = PWM_RESET_MR0; //clear flag
> > PWM_TCR = (1<<1);
> > PWM_TCR=(1<<0);
> > VICVectAddr = 0;
> >}
> >
> Your order of arithmetic is wrong. Change to:
>
> PWM_MR4 = (PWM_MR0 *DC1)/100;
>
Yes, correct. I loose precision when I first devide and then
multiply.I altered it as you specified here but still the problem
seems to be using the variable DC1. The outpui-value is continuously
high (100% DC). It does not seem to be allowed to use DC1 in this
function!!!?
I use gnu-arm 3.4.3.Message
Re: float in interrupt function?
2005-04-08 by ed_hage
Attachments
- No local attachments were found for this message.