Go Down

Topic: fixed point variables? (Read 910 times) previous topic - next topic

hategps

Helo everybody, i'm trying to convert a simulink model from float to fixed point variables to see if i can improve or not its velocity on arduino. i should decide a suitable data type to run on target for Arduino mega2560. simulink suggestion is: fixdt(Signed, WordLength, FractionLength). however,it's not clear (to me) if that data type becomes an int type on arduino or not and how it is treated in that case.
i've tried a trivial model using that data type, it runs on arduino but doesn't seem to improve velocity..
what do you think about it?

Grumpy_Mike

Quote
i've tried a trivial model using that data type, it runs on arduino but doesn't seem to improve velocity..

A trivial example will not, but how about one where you do some arithmetic on the value.
Post the code if you want specific help.

hategps

the simple model was still in simulink and i did it just to know if arduino can handle fixdt data type. i wouldn't even know how to write that data type on the ide. is there any easier way to represent a fixed point variable?

michinyon

There is no "fixed point" type for Arduino, as far as I am aware.

What you can do,  is represent your problem using integers.    For example,  if your GPS problem originally
uses floating point numbers which represent metres,   you can change it to use integers which represent millimetres.

lloyddean

What is the range of values that your fixed type requires?
Are you most concerned with speed or accuracy?

Go Up