lpcware

LPC1850

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by g.seidl on Wed May 02 23:52:24 MST 2012
Does anybody tried to configure a port pin as a DAC output ? I tried it but without success.
Here is my code snipplet by using CMSIS functions. Any ideas ?

#define ENAIO2 *((uint32*)0x40086c90)
void main(void)
{
  unsigned int 32DacValue;
  SystemInit();
  CGU_Init();
  // 1. Init DAC P4_4 = DAC Output
  GPIO_SetDir(4, 4, 0);
  scu_pinmux(4, 4, 0, 0);
  ENAIO2 |= 1;

  LPC_DAC->CR = 0;
  LPC_DAC->CTRL = 1<<3;
  LPC_DAC->CNTVAL = 0;
  DAC_Init(LPC_DAC);
  // 2. Write to DAC
  while(1)
  {
    for(u32DacValue = 0; u32DacValue < 0x400; u32DacValue++)
    {
       DAC_UpdateValue (LPC_DAC, u32DacValue);
    }
  }

Outcomes