Main Site Documentation

G120 how to set pwm 8-11?


#1

hi every one

I have a quick question. how to setup pwm port 8-11?

PWM 0-7, works fine the following way:

 
PWM Cookie = new PWM(Cpu.PWMChannel.PWM_0, Freq, Dutycycle, false);

I can see that there is only define pwm 0-7 in “Cpu.PWMChannel”


        public enum PWMChannel
        {
            PWM_NONE = -1,
            PWM_0 = 0,
            PWM_1 = 1,
            PWM_2 = 2,
            PWM_3 = 3,
            PWM_4 = 4,
            PWM_5 = 5,
            PWM_6 = 6,
            PWM_7 = 7,
        }


#2

@ Larsc -

[quote]
PWM port 8-11[/quote]

PWM on port 8, pin 11
or PWM id from 8 to 11?


#3

PWM id from 8 to 11


#4

@ Larsc -

The following example is how you set a PWM channel higher than the allotted enumerations:

PWM Cookie = new PWM((Cpu.PWMChannel)8, Freq, Dutycycle, false);

You only need to type cast the number as that channel type.


#5

@ Aron

Thanks, I got it to work yesterday, I use the same method :slight_smile: