Sections
You are here: Home Forum Devices and Hardware PWM channel A and B behaviors? (voltages)

PWM channel A and B behaviors? (voltages)

Up to Devices and Hardware

PWM channel A and B behaviors? (voltages)

Posted by David Stuve at August 30. 2010

I'd never used the PWM before, so just for fun I tried hooking up two LEDs: one to digital out 0, and the other to digital out 1.  Then I ran the following code, expecting both LEDs to be driven the same (about 50% duty, then about 100%)  The documentation implies that channel A and B are driven the same by default?

 

 

void pwm_test()

{

    // turn on the PWM outputs

    PwmOut_SetActive( 0, 1 );

 

 

 

    PwmOut_SetDuty( 0, 500 );

    Sleep( 2000 );

    PwmOut_SetDuty( 0, 1000 );

    Sleep( 2000 );

 

 

    // turn the PWM outputs off

    PwmOut_SetActive( 0, 0 );

 

}

 

Instead LED on Channel A (digital out 0) lights up and gets brighter as expected, and the LED on channel B (digital out 1) does nothing.  I disconnected the LEDs and using my multimeter I saw that digital out 0/channel A generates about 2.4v then 4v, but digital out 1/channel B generates ~.3v and then ~.5v which is no where near 2.4 and 4v.

 

It looks like either a) there's a trick to getting channels A and B to behave the same, b) they don't and I misunderstood the documentation, or c) something is wrong with my board.  Any ideas?

 

I'm using controller v1.0 (one of the very first!) with mcbuilder 0.6.0

 

Thanks,

 

Dave

 

 

Powered by Ploneboard
Document Actions