| ??? 10/18/07 14:17 Read: times |
#145890 - LPC935/6 ADC |
Hi,I need to use all of the 8-bit ADC channels of the LPC935/6. Right now it is working fine with 3 of them. Channels AD10, AD11, AD12. But when I select the last channel AD13 it (AD13, P0.4) does not give me a result. It gives a negative number. I have tried using only AD13 and does not work. I am using the same power supply for all ADC channel inputs, but I use different multipliers to get different results. I am using several peripherals in this program. (Timer & UART)
However, I have a pilot program where I am only using the ADC peripheral and all of them work fine (give me an expected result) ADC10-3. I have tested these programs with different chips, EMP900 and the result is the same. What could be wrong? Can anyone help me? Erik? I have selected AutoScan, Single conversion mode. Here is copy of the program I am using:
// channel 0
P0M1 |= 0x02;
P0M2 &= ~0x02;
// channel 1
P0M1 |= 0x04;
P0M2 &= ~0x04;
// channel 2
P0M1 |= 0x08;
P0M2 &= ~0x08;
// channel 3
P0M1 |= 0x10;
P0M2 &= ~0x10;
:
'Call ADC1 to convert
void ConvertVal (void)
{
ADMODB |= 0x40; // configure clock divider 3.3 MHZ or less
ADMODB &= ~0x08; // disable dac1
ADCON1 |= 0x04; // configure adc1 and enable
ADCON1 &= 0x8C; // disable all triggers
ADINS |= 0xF0; // Select all channels
ADMODA |= 0x10; // select mode
ADCON1 |= 0x01; // select trigger
while ((ADCON1 &0x08) == 0);
V0 = AD1DAT0;
V1 = AD1DAT1;
V2 = AD1DAT2;
V3 = AD1DAT3; // Not working, Not converting
ADCON1 &= 0x8C; // disable all triggers
V1 = ((((V1/(255/5))*100)/91))*9;
V0 = ((((V0/(255/5))*100)/91))*17;
V3 = ((((V3/(255/5))*100)/91))*3;//Gives Zero or -number
V2 = ((((V2/(255/5))*100)/91))*50;// 250/5
}
|
| Topic | Author | Date |
| LPC935/6 ADC | 01/01/70 00:00 | |
| I do not know about you .... | 01/01/70 00:00 | |
| Negative number | 01/01/70 00:00 | |
right and wrong | 01/01/70 00:00 | |
| What about! | 01/01/70 00:00 | |
| AD13 pin is a DAC pin as well, are you sure there | 01/01/70 00:00 | |
| Code Architect | 01/01/70 00:00 |



