Scicos DemoBoard PWM

A forum useful to discuss the details of the ScicosLab code generator.

Moderator: paolo.gai

Locked
kailup
Newbie
Posts: 14
Joined: Thu Apr 23, 2009 10:16 am

Scicos DemoBoard PWM

Post by kailup » Thu Oct 15, 2009 4:09 am

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

paolo.gai
Administrator
Posts: 875
Joined: Thu Dec 07, 2006 12:11 pm

Re:Scicos DemoBoard PWM

Post by paolo.gai » Thu Oct 15, 2009 4:10 pm

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

dds
Newbie
Posts: 3
Joined: Thu Jan 31, 2008 2:50 pm

Re:Scicos DemoBoard PWM

Post by dds » Thu Oct 15, 2009 6:10 pm

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

kailup
Newbie
Posts: 14
Joined: Thu Apr 23, 2009 10:16 am

Re:Scicos DemoBoard PWM

Post by kailup » Mon Oct 19, 2009 2:13 pm

Hi Dario,

Thanks, it works fine. :)

rgds,
CL

Locked