digital to analog converter

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

digital to analog converter

跳至解决方案
2,555 次查看
ThomasH
Contributor II
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
标签 (1)
标记 (1)
0 项奖励
回复
1 解答
1,104 次查看
SteveRussell
Contributor III

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.)

在原帖中查看解决方案

0 项奖励
回复
1 回复
1,105 次查看
SteveRussell
Contributor III

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.)

0 项奖励
回复