Hi, I'm using LPC935 and I want to set the built in AD converter. I have to use P0.0 pin, so I have written the following code (The pin is configured as input only): void InitADC() { ADCON0 = 0x45; //Enable ADC0 and Interrupt on conversion done //Single mode ADMODA = 0x01; //Freq div ADMODB = 0x40; //CCLK/3 //Select P00 ADINS = 0x01; //Enable P00 input EAD = EA = 1; //Enable IRQ } The matter is that even I run this piece of code the ADC settings are still the same. Even if I play step by step, every line of this routine can't make any modificatione in ADC registers. What's the matter? Thanx in advance
who are you? or could it be the coincidence of the century that "Marco P" posted an identical post at 8052.com Erik
Hi Erik, I'm sorry but "emme" stands for "M" that goes to Marco. I don't know about "P": on 8052.com my signature is the same as in this forum... Could you help me?
I've followed your suggestion but the problem stand still: I've created code with "CodeArchitect" but the fact is that every changes in AD registers are not allowed... void InizADC(void) { // configure clock divider ADMODB |= 0x40; // set adc0 channel pins to input only (disables digital output) // channel 1 (P00) P0M1 |= 0x01; P0M2 &= ~0x01; // disable dac0 ADMODB &= ~0x04; // set boundaries AD0BH = 0xFF; AD0BL = 0x00; // use boundary limits for all channels ADMODB |= 0x01; // configure adc0 and enable (also enables dac0) ADCON0 |= 0xC4; // set adc1 channel pins to input only (disables digital output) // channel 0 P01 P0M1 |= 0x02; P0M2 &= ~0x02; // channel 1 p02 P0M1 |= 0x04; P0M2 &= ~0x04; // disable dac1 ADMODB &= ~0x08; // set boundaries AD1BH = 0xFF; AD1BL = 0x00; // use boundary limits for all channels ADMODB |= 0x02; // configure adc1 and enable (also enables dac1) ADCON1 |= 0xC4; // set isr priority to 0 IP1 &= 0x7F; IP1H &= 0x7F; // enable adc interrupt EAD = 1; } Is there something else tha I can do to fix it? Thank you
but the fact is that every changes in AD registers are not allowed... What do you mean? Erik
I'm sorry but "emme" stands for "M" that goes to Marco. Then why on earth not use 'M' ? Erik
Hi, when I first enter in the routine and proceed step by step, with the "Peripheral-->ADConverter -->ADC0/DAC0" of the ide open, for every line that I go through, there aren't changes in the appropriate register, for example: if before the line: ADMODB |= 0x40; (*) The ADMOB register is: 0x00 even after the execution of instruction (*) the ADMOB is always 0x00!!!
if before the line: ADMODB |= 0x40; (*) The ADMOB register is: 0x00 even after the execution of instruction (*) the ADMOB is always 0x00!!! PLEASE give COMPLETE information. HOW do you determine this? Erik
In the IDE (uVision3) menu, look in Peripherals--> A/D Converter ---> ADC0/1 Thera are all register concern to ADC. But even if I do in the "command output window" of the IDE: eval ADMOB the result is always 0x00
In the IDE (uVision3) menu, look in Peripherals--> A/D Converter ---> ADC0/1 I have no idea what you mean, are you saying this is with the simulator? if this is so, who says that the problem is not the simulator? eRIK
I'm not using the simulator, I'm using the emulator. The HW that is connected to run well from the electric standpoint, no electrical conflict is alive. What is unclear to you?
What is unclear to you? why it does not work because I have the very same working. Erik
one thing. I have no idea if this is your problem, but you are doing one thing "nonstandard" It is customary to do all port configuration at the very beginning (right after the jump from 0) not as part of individual initializations. Erik
what emulator, I use CEIBO. Erik
the emulator is EPM900 from Keil, I cannot do anymore, I'm sure from electrical standpoint and from sw too but the system doesn't run anyway...
Are you using an LPC935 Bondout chip in EPM900. Reinhard
I'm using Keil EPM900 Emulator for Philips P89LPC9xx