Why are Kinetis 12-bit DAC data registers 8-bit long?

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

Why are Kinetis 12-bit DAC data registers 8-bit long?

773件の閲覧回数
schen
Contributor III

The Kinentis 12-bit DAC in devices such as KL25Z or K64F has the data registers defined as two 8-bit registers. The byte ordering is the same as the ARM core little endian. I modified the code to write to the DATL:DATH as a singular 16-bit register and it works just fine. Is there a reason to treat them as two 8-bit registers?

int main(void) {

  void DAC0_init(void);

    int i;

    short* dac0dat = (short*)&(DAC0->DAT[0].DATL);

    DAC0_init();

    while (1) {

        for (i = 0; i < 0x1000; i++) {

//            DAC0->DAT[0].DATL = i & 0xff;

//            DAC0->DAT[0].DATH = (i >> 8) & 0x0f;

            *dac0dat = i;

        }

    }

}

ラベル(2)
タグ(3)
1 返信

565件の閲覧回数
Hui_Ma
NXP TechSupport
NXP TechSupport

I think the DAC module IP original designed for 8-bit MCU products, that's why the register is in 8-bit.


Wish it helps.
best regards
Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信