Hi!
I´m using the DAC on the mc9s12e64 the first time and I´m woundering about the both 8 bit left and right oriented data register DACD. What´s the advantage of this??
Thanks,
Thomas
When trying to do computation rapidly on real-world quantities, it is often helpful to look at integers as fractions of a "full scale" value. This has the nice feature that multiplication of two quantities less than 1 will always give a result less than 1. So to scale a quantity, you just do a multiply and take the most significant bits. No shifting involved, just word operations.
Its real easy in assembler, but a little awkward in C, so hiding it in some function written in assembly may be a good idea.
It seems like a fractional arithmetic class in C++ would make this easy, but I'm not aware of one. (I haven't had occasion to look.)
When trying to do computation rapidly on real-world quantities, it is often helpful to look at integers as fractions of a "full scale" value. This has the nice feature that multiplication of two quantities less than 1 will always give a result less than 1. So to scale a quantity, you just do a multiply and take the most significant bits. No shifting involved, just word operations.
Its real easy in assembler, but a little awkward in C, so hiding it in some function written in assembly may be a good idea.
It seems like a fractional arithmetic class in C++ would make this easy, but I'm not aware of one. (I haven't had occasion to look.)