This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Can' t configure ADC of LPC935!

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

Parents
  • if I can truly emulate serial communications, analog comparator functions and so on why i can't emulate ADC?

    Because you do not have the bondout chip (which is, without actually counting, I think, 64 pins) that allow the emulator to "see" everything that goes on inside the uC and STOP it on the spot.

    There are means of "emulating" which are not "true emulation" since they are code intrusive (e.g. reformat the code and write the flash to insert a "call brkpt" and such "emulators" do not STOP, they just stop. Thus a few operations such as an ADC completing conversion can happen before the STOP is reached. Such "emulators" are a hybrid and can by design never be completely "true". Whether this is what you actually have and see I do not know.

    A suggestion:
    set the SFR you refer to, IMMEDIATELY read it to a RAM location (a variable) then breakpoint and check that variable, not the SFR. That way you will know if it is the SFR or the emulator that fail (I assume you have verified that you can "watch" variables).

    One last possibility:
    are you dead sure that you are working with a 935 CHIP, not a 932?

    Erik

Reply
  • if I can truly emulate serial communications, analog comparator functions and so on why i can't emulate ADC?

    Because you do not have the bondout chip (which is, without actually counting, I think, 64 pins) that allow the emulator to "see" everything that goes on inside the uC and STOP it on the spot.

    There are means of "emulating" which are not "true emulation" since they are code intrusive (e.g. reformat the code and write the flash to insert a "call brkpt" and such "emulators" do not STOP, they just stop. Thus a few operations such as an ADC completing conversion can happen before the STOP is reached. Such "emulators" are a hybrid and can by design never be completely "true". Whether this is what you actually have and see I do not know.

    A suggestion:
    set the SFR you refer to, IMMEDIATELY read it to a RAM location (a variable) then breakpoint and check that variable, not the SFR. That way you will know if it is the SFR or the emulator that fail (I assume you have verified that you can "watch" variables).

    One last possibility:
    are you dead sure that you are working with a 935 CHIP, not a 932?

    Erik

Children