Main Site Documentation

PWM on FEZ Hydra - VS2012, .NETMF 4.3, GHINETMF v4.2


#1

Hi All its been a while!

I am looking for a some advise. It appears as the Hydra is different again with the new library updates.

Can someone please advise: (Code not working)


uint[] Buffer = new uint[2];
Buffer[0] = 1000;
Buffer[1] = 10000;

SignalGenerator SG = new SignalGenerator((Cpu.Pin)GHI.Hardware.FEZHydra.Pin.PD16, true, 1);
SG.Set(true, Buffer, 0, Buffer.Length, true);

First of all, is this the best way to implement PWM on the PWM Pins?

If not, can someone please advise?

Have the issues been solved with PWM in the past on the Hydra?

Thanks all.

Chris


#2

Signal generator is software driven. You should use the actual pwm hardware instead just like before


#3

Gus, can you provide the Class that PWM sits in please? Or a link to the correct documentation.

Reason for asking: https://www.ghielectronics.com/community/forum/topic?id=8345


#4

Ok after tons of looking, found it!

Google and other searches bring up: (THIS IS WRONG!!!)


using GHIElectronics.NETMF.Hardware; 


PWM MyPWM = new PWM(Cpu.PWMChannel.PWM_3, 10000, 0.1, false);
MyPWM.Start();

The Tutorials are incorrect: https://www.ghielectronics.com/docs/18/pwm

PWM on the Hydra (Gadgeter) is in: (Need a Reference to: Microsoft.SPOT.Hardware.PWM)


using Microsoft.SPOT.Hardware;

PWM MyPWM = new PWM(Cpu.PWMChannel.PWM_7, 1000, 0.5, false);
MyPWM.Start();

All the Best

Chris


#5

@ Gus,

Nice work on the FEZ Config! Some of this is new to me as I was on old VS and .NETMF

Thanks

Chris


#6

For some reason for me Microsoft.SPOT.Hardware does not contain a class for PWM. The version I am using is 4.2.0.0. Any ideas as to why this is the case?


#7

@ willisl - The PWM reference is a separate reference library that must be added.


#8

Thanks for the quick reply Aron.

What library do I reference? How do I get this library?

The GHI PWM documentation just mentions “The PWM feature has been implemented by Microsoft.SPOT.Hardware.PWM assembly”.


#9

@ willisl - That would be the assembly that you need. To add the assembly, you need to go to References in the Solution Explorer and right click. Select Add references and select the Microsoft.SPOT.Hardware.PWM assembly. There is a photo attached for reference.


#10

Thanks Aron, I thought that the the PWM class was apart of “Microsoft.SPOT.Hardware” and not that it was a separate reference assembly altogether.

Thanks for the clarification.