[AVR] Square on AVR?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[AVR] Square on AVR?

madscientistatlarge
Is it reasonable to calculate the square root of a 16 bit or preferably 20 bit integer?  I'll need to do this 400 times a second.  I do have an alternate hardware plan that would work, but I'd prefer using the Square root.  It's a PID controller and I'd rather use a "constant" (between calculations at least) Voltage output, or I can use a fet to do PWM without the math (with square root I'd calculate the power required, take the square root and set the voltage output to that value).  This would reduce the noise from the high power (240W) switching converter.  Alternately I could set a fixed max voltage and drive a fet with a pwm signal.  Just wondering how expensive that calculation would be in terms of processor cycles.


Sent with ProtonMail Secure Email.



--
http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist