Accueil » Développeur » Tutoriels » Use the Digital Analog Converter (teensys 3.5)

  • µC : Teensys 3.5

Initialize the Digital Analog Converter :

void dac_init(void)
{
// Enable the DAC0 clock
SIM_SCGC2 |= SIM_SCGC2_DAC0;

// Enable the DAC1 clock
SIM_SCGC2 |= SIM_SCGC2_DAC1;

// Enable the DAC0 module, with 3.3V reference tension
DAC0_C0 = DAC_C0_DACEN | DAC_C0_DACRFS;

// Enable the DAC1 module, with 3.3V reference tension
DAC1_C0 = DAC_C0_DACEN | DAC_C0_DACRFS; 

}