Hello All,
I am trying to do math on a microcontroller. I'm using an 8bit micrcontroller from Atmel. I've read several articles on Fixed Point arthmetic and I am still a little confused on Fixed Point Arithmetic in regards to microcontrollers. The articles do not go into depth as to what happens in the microcontroller. Do microcontrollers without Floating point capability only understand integers? If so, Is the answer to Y=3/4 equal to zero in the microcontroller?
The other question I had is what happens if you have two 8bit integers (Y=100, X=100) and you multiply them ( Z=100x100, Z is also 8 bits). This creates an overflow but what actually happens when a variable overflows? I've googled it and I've seen explanations from "Undefined Behaviours" to wrapping. Any feedback would be greatly appreciated.
I am trying to do math on a microcontroller. I'm using an 8bit micrcontroller from Atmel. I've read several articles on Fixed Point arthmetic and I am still a little confused on Fixed Point Arithmetic in regards to microcontrollers. The articles do not go into depth as to what happens in the microcontroller. Do microcontrollers without Floating point capability only understand integers? If so, Is the answer to Y=3/4 equal to zero in the microcontroller?
The other question I had is what happens if you have two 8bit integers (Y=100, X=100) and you multiply them ( Z=100x100, Z is also 8 bits). This creates an overflow but what actually happens when a variable overflows? I've googled it and I've seen explanations from "Undefined Behaviours" to wrapping. Any feedback would be greatly appreciated.