How to get the DAC working on an MKE16F MCU

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

How to get the DAC working on an MKE16F MCU

991 Views
ammarbazzaz
Contributor II

I am having trouble getting output on the DAC0 pin of my MKE16F512VLH16 MCU.  Have done the following:

1) PCC->CLKCFG[PCC_PORTE_INDEX] |= 0x40000000; // enable clock on PORT E

2) PCC->CLKCFG[PCC_DAC0_INDEX] |= 0x40000000; // enable clock on DAC0

3) DAC0->STATCTRL |= 0x60800; // enable output buffer, enable test ouput, enable DAC0

4) DAC0->DAT[0] = 1023; //bias_adjust; // send bias adjustment to DAC0 out

But I get no output on the physical Pin (PORTE9 PIN 16 on 64LQFP), expecting to see (1024/4096)*5000mV or 1250mV.

Any suggestions would be greatly appreciated.  Thanks in advance.

0 Kudos
Reply
2 Replies

923 Views
mjbcswitzerland
Specialist V

Hi

I would check the use of DAC0_STATCTRL.
Bit 0x000080000 enables the DAC but you look to have it still disabled.

Regards

Mark

0 Kudos
Reply

923 Views
ammarbazzaz
Contributor II

Hi Mark, 5 minutes after posting I realized I was missing a trailing 0 in my |=, so I was off by 4 bits..added a 0 and problem solved! Thank you very much for responding though :smileyhappy:

Best

Ammat

Get Outlook for iOS<https://aka.ms/o0ukef>

0 Kudos
Reply