On Sun, Apr 25, 2010 at 09:19:36PM +0100, Andy Pugh wrote: > There are 4 PWMs on the Arduino, though two share a timer. > The Mega has 14 PWM pins though, so presumably has rather more timers > and possibly more options (I have not looked) > > I think that means that it could be done, but you might run out of CPU > calculating the phase angles and duty cycles.
Using a table for one quadrant (to save flash memory), scaled to provide timer load values directly, there shouldn't be any significant calculation involved, beyond wrapping and reversing three table pointers, 120° apart. There should be CPU cycles to burn. Without going all the way to an Xmega chip, the Atmel AT90PWM3 is worth considering: http://www.atmel.com/dyn/resources/prod_documents/doc4317.pdf and a quicker overview: http://www.atmel.com/dyn/resources/prod_documents/doc7670.pdf e.g. "When they are synchronized the PSC can drive dependent bridges (DC, BLDC, AC motors ...)" The on-chip "Power Stage Controller" is a 3-phase PWM timer set, which will drive your three phase bridge. It has hardware dead time control, and an input for hardware deactivation of the power bridge on error detection. (i.e. doesn't rely on software.) It beats trying to graft all that onto a general micro manually. The analogue to digital converter can also be synchronised with the PSC, e.g. to sample instantaneous bridge current, e.g. with a sense resistor. (Trying to pick some sort of average off a sense resistor, using an RC integrator is second best.) Atmel also has a BLDC controller "reference design" board, and a bunch of aplication notes, e.g. AVR194: Brushless DC Motor Control using ATMega32M1 AVR443: Sensor-based control of three phase Brushless DC motor Application Note - ATA6833/34 BLDC Motor Control Kit (A search for "BLDC motor control" on their home page gave 10 pages of hits.) If only there were time to jump into that pool too. Erik -- We only have to look at ourselves to see how intelligent life might develop into something we wouldn't want to meet. - Stephen Hawking ------------------------------------------------------------------------------ _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
