AnsweredAssumed Answered

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

Question asked by schen on Aug 19, 2014
Latest reply on Aug 21, 2014 by Hui_Ma

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;

        }

    }

}

Outcomes