Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/20/07 20:24
Read: times


 
#135439 - help using DAC with LPC925
Hello,
I'm trying to use the DAC as well as the ADC in the LPC925 at the same time but I'm having some trouble initializing both of them at the same time. I can get AD1 working fine, but i can't get the DAC to work. I tried using Code Architect but it gives me some strange variables that Keil does not know what it is nor can i find them in the data sheets.
This is what code architect gives me for using the DAC in the initialization section:

void adc_init (void)
{

// set dac1 pin to input only (disables digital output)
P2M1 |= 0x01;
P2M2 &= ~0x01;
// init dac1 value to zero
AD0DAT3 = 0x00;
// enable dac1 output
ADMODB |= 0x04;
// enable adc1 (also enables dac1)
ADCON0 |= 0x04;

}

First there is no P2M1/P2M2 in the LPC925, so I'm guessing it meant to say P0M1/P0M2 instead. Also, there is no AD0DAT3, i think it meant to say AD1DAT3. It also calls for ADCON0 but there is no ADCON0 in the LPC925, there is an ADCON1.
So here is my Initialization code for the first two A/Ds (ADC10/P0.1 and ADC11/P0.2) and the DAC1/P.04 active at the same time.

void ADC_Init(void)
{
// configure clock divider
ADMODB |= 0x40;

// set adc1 channel pin to input only (disables digital output)
// channel 0
P0M1 |= 0x02;
P0M2 &= ~0x02;
// set adc1 channel pin to input only (disables digital output)
P0M1 |= 0x04;
P0M2 &= ~0x04;
// set adc1 channel pin to input only (disables digital output)
P0M1 |= 0x10;
P0M2 &= ~0x10;

// init dac1 value to zero
AD1DAT3 = 0x00;
// enable dac1 output
ADMODB |= 0x04;
// configure adc1 and enable (also enables dac1)
ADCON1 |= 0x44;

// set isr priority to 0
IP1 &= 0x7F;
IP1H &= 0x7F;

// enable adc interrupt
EAD = 1;
}

Can anyone tell me what I'm doing wrong. I'm using the internal RC circuit as the main clock.

Any helps is greatly appreciated.

Enrique


List of 10 messages in thread
TopicAuthorDate
help using DAC with LPC925            01/01/70 00:00      
   Show them            01/01/70 00:00      
      varibles            01/01/70 00:00      
         Configured Correctly?            01/01/70 00:00      
            I did that once            01/01/70 00:00      
               I did            01/01/70 00:00      
                  try again and ...            01/01/70 00:00      
                     will try!            01/01/70 00:00      
                     Hopefully Fixed            01/01/70 00:00      
                        Fixed            01/01/70 00:00      

Back to Subject List