Main Site Documentation

IO60P16 PWM for 50Hz/20ms


#1

Hi,

I am using .NETMF 4.2 and a IO60P16 card.
I need to generate a signal for servo motor control with a 20ms period (or 50Hz freq.).

I am using this code:

IO60P16.PWM pwm0;
pwm0 = new IO60P16.PWM(io60p16, IO60P16.PWMPin.PWM0, IO60P16.PWM.TickWidth.TickWidth_Servo_23438hz_42666ns);
pwm0.SetPulse(60, 255);

Unfortunatelly, 23438Hz seems to be the smallest tick width frequency in this version of .NETMF.

Someone maybe think I could use:

pwm0.SetPulse(60, 470);

But SetPulse function only accepts byte types, ie, only numbers < 255.

I am stuck. Is there a way to generate this frequency? Is the IO60P16 hardware incompatible with this low speed PWM?

Thanks a lot.


#2

@ TNT - Hi TNT and welcome to the community.

The IO60’s current driver is statically set using a particular clock source and divider for PWM. You can possibly manually set the clock to the frequency that you are requiring but it will require you to either modify the Gadgeteer driver (information how found here: https://www.ghielectronics.com/docs/122/gadgeteer-driver-modification ) or communicate with the module directly via I2C. The following link provides a datasheet on how to achieve this: http://www.cypress.com/?docID=31413