Page 1 of 1

Scicos DemoBoard PWM

Posted: Thu Oct 15, 2009 4:09 am
by kailup
Hi,

I found some problem on the DemoBoard PWM. The calling function of the PWM \"EE_pwm_set_duty_f\" under flex_daughter_pwm.c\" calls the function via:

EE_pwm_set_duty_f( pin-1 , *duty);

so the chan = pin - 1, in which 0 = 1 in the DemoBoard PWM block under scicos.

However, the chan is define as:
#define EE_PWM_PORT1 1
#define EE_PWM_PORT2 2

in ee_flex_demoboard.h, resulting the \"swith case\" would recognized only 1 channel (recognize channel 1 as 2), while the channel 2 is not recognized.

I think it should be either changing the define chan to:
#define EE_PWM_PORT1 0
#define EE_PWM_PORT2 1

or the pin-1 to pin in the calling function.

Thanks.

Regards,
Chin Luh

Re:Scicos DemoBoard PWM

Posted: Thu Oct 15, 2009 4:10 pm
by paolo.gai
Dear Tan Chin,

Thanks!

I guess we can just put

Code: Select all


EE_pwm_set_duty_f( pin , *duty);
in place of \"pin-1\"... in that way the channel should be ok...

I tell taht to Dario and then we are going to update the SVN... (this patch will be released with the next update of the eclipse plugins...)

Grazie!

PJ

Re:Scicos DemoBoard PWM

Posted: Thu Oct 15, 2009 6:10 pm
by dds
Dear Tan Chin,
thanks for your help.
I made the following changes.

svn diff
Index: flex_daughter_pwm.c
===================================================================
--- flex_daughter_pwm.c (revision 356)
+++ flex_daughter_pwm.c (working copy)
@@ -19,7 +19,7 @@
if ((pin 2))
return;

- EE_pwm_init( pin-1 , 20000 , 0 );
+ EE_pwm_init( pin , 20000 , 0 );
}

static void inout(scicos_block *block)
@@ -33,7 +33,7 @@
if ((pin 2))
return; //** refuse not supported PWM

- EE_pwm_set_duty_f( pin-1 , *duty);
+ EE_pwm_set_duty_f( pin , *duty);
}

everything ok??
Dario

Re:Scicos DemoBoard PWM

Posted: Mon Oct 19, 2009 2:13 pm
by kailup
Hi Dario,

Thanks, it works fine. :)

rgds,
CL