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
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
Q: "Are you using an LPC935 Bondout chip in EPM900?" A: "I'm using Keil EPM900 Emulator for Philips P89LPC9xx" analogy Q: are you eating an apple or an orange?" A: "I bought it at the fruit stand" Erik
dear Erik, I'm a newbye on ucontroller and I don't know what "bondout" stands for. I'm fighting very hard on this problem and I have no idea about fix it, so if you want to joke you can but it's better for me if you don't, I thank U for your support I'm sure anyway that if everybody has your knowledge that world will goes better but unfortunately the things are different...
I'm a newbye on ucontroller and I don't know what "bondout" stands for. then, another question: how many pins does the chip in your emulator have (a bondout has more than a regular) Erik
Hi, there are 28 pin. I've connected, for test purpose, channel 1 of ADC0, and it point to pin number 3 if I have not done any mistake. Do you think that the problem is wrong wiring?
Then you do NOT have a bondout chip and you can NOT emulate. Erik Is it not amazing how simple an answer can be when all facts come to light. Please keep that in mind next time you post 1) chip 2) frequency 3) type of board (my own/ Keil / acme ...) 4) code snipped (if appropiate) 5) tool(s)
Why? if I can truly emulate serial communications, analog comparator functions and so on why i can't emulate ADC?
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
the chip is really a 935. I've followed your suggestione and i've written the code: void InizADC(void) { char Dummy; // configure clock divider ADMODB |= 0x40; Dummy = ADMODB; ... Dummy is equal to ADMODB that is equal to 0x00! By the way I thank u to waste your time trying to help me.