digital to analog converter

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

digital to analog converter

ソリューションへジャンプ
3,206件の閲覧回数
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,755件の閲覧回数
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,756件の閲覧回数
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 件の賞賛
返信