ROBOTC.net forums
http://www.robotc.net/forums/

Variable PWM on Motor Ports
http://www.robotc.net/forums/viewtopic.php?f=11&t=3337
Page 1 of 1

Author:  ravitek [ Tue Jun 21, 2011 10:06 am ]
Post subject:  Variable PWM on Motor Ports

Howdy folks,
I did a search and couldn't find anything relative to what I was looking for. I'm trying to wire LEDs to our VEX Cortex via the 2- and 3-pin motor ports. I've discovered that the battery voltage pin stays high independent of programming, so I have a constant ~7.2V available, so I realize the only source of variable voltage I have control over would be the PWM signal pin.
I've measured the output at -127 and 127 in RobotC, and the voltage remains relatively the same (~1.8V), but duty cycle varies by over 16%. Is there any way to override the default duty cycles and stretch out the pulse (very very dim LED) vs. very quick (illuminated LED)?
I know the digital I/O ports can be used very simply for LED functions, but we've got a similar setup occupying all of the I/O ports so I only have motor ports to my disposal.

Any help would be appreciated, thanks!

Author:  jbflot [ Wed Jun 22, 2011 8:48 am ]
Post subject:  Re: Variable PWM on Motor Ports

Hi Ravitek,

Unfortunately ROBOTC does not provide that kind of low-level access to the duty cycle. This is largely the case to prevent the motors and motor ports from burning out from accidental abuse.

What is it that you're trying to signal using the LED patterns? Is it something that a fast/slow spinning motor or servo + attachment could show? Also, the VEX Flaslight can be set to different brightness levels using ports 1 and 10: http://robomatter.com/Shop-By-Robot/VEX ... hlight-Kit

Author:  ravitek [ Wed Jun 22, 2011 9:16 am ]
Post subject:  Re: Variable PWM on Motor Ports

Thanks for the prompt response, jbflot.
My idea was to illuminate individual segments of a seven-segment display with each individual motor port. I'm still in the process of wiring a 'breakout' breadboard with the proper wiring, I imagine I'll still give it a shot and see if it's easy to discern the illuminated (127) digits vs. the dimmer (-127) digits.

Would any one have experience with MPLab (or other IDEs) and know if it has the ability to vary the PWM duty cycles? I've seen the screenshot during setup where they declare PWM(2,255) and PWM(2,0) and wonder if the 0-255 range is complete high and low.

Your suggestion may be my plan B, perhaps a servo with an attachment and labels showing it can reach both extremes. The motivation in my project is the ability to test every individual port on the CORTEX before renting the kit out to competitors. I liked the idea of a 7-seg and as long as it presented the proper port number (selected via joystick), the motor ports were functioning.

Author:  jbflot [ Thu Jun 23, 2011 2:16 pm ]
Post subject:  Re: Variable PWM on Motor Ports

I don't believe that MPLAB is compatible with the VEX Cortex, since it's a compiler specifically for PIC microprocessors. ROBOTC and easyC (which provides even less low-level access) are the only two programming environments for the VEX Cortex.

Good luck with the breakout board!

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/