Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Math With an 8-bit MCU

Status
Not open for further replies.

Mutad0r

Junior Member level 3
Joined
Feb 13, 2013
Messages
28
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,608
So I'm making a spiderbot and am using 8-bit mcu's. To calculate the angle every joint has to be at, use various mathy things like the pythagoran theorem and tangents, it all works fine on paper, but i'm not so sure about whether it would work on an 8-bit mcu. I'm so late in the design process that changing to another mcu would really be a hassle though...I DO have that choice, I even have a dsPIC, so if that is REALLY necessary, I will do that.


A Little about my current configuration:

I have 4 mcu's in total, they are all pic18f47j53. I had to use more than one because the no mcu alone had 18 pwm signal sources (the robot has 6 legs with 3 Motors each, a 1D joint and a 2D joint).

So basically my current idea is that there's one master that sends out coordinates for each of the legs to the slave mcu's and the slaves calculate the angles and set the Motors in motion untill the angle is appropriate.


What the problem is:
I don't know whether the mcu is capable of calculating the angles. Having 8-bit values is enough for me, the maximum leg coordinate from the reference point of 255x255 is quite enough, but using those values to calculate other things can get to higher values, like 360.

The other thing is that can the pic succesfully calculate square, square root and tangets? I can make a lookup table for the tangents, but then I would need double precision numbers? Making a lookup table for the pythagoran theorem, I would need 255*255 bytes of memory, which is half of the amount available to the pic.

if I was to use the dsPIC, I would have to redesign and remake the pcb. In that setup I would still probably use 4 mcu's, but all the calculating is done By the master, and the angle values are sent to the slaves.


If the 8-bit pic can manage the calculations, even slowly, then I'd rather go that route and just make a short term memory for different leg positions because the values repeat a lot and recalculating them is silly anyhow( leg forward, leg backward, leg forward, leg backward.......)
 

Most 8-bit PIC compilers provide the requested functions in their math library. You'll want to check if the involved code size and calculation time fits your requirements. I guess it does.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top