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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

774 Views
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;

        }

    }

}

Labels (2)
Tags (3)
1 Reply

566 Views
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 Kudos
Reply