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

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

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

775 次查看
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 回复

567 次查看
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 项奖励
回复