Below is that program which prints potentiometer value in serial window.
void delay (void) { /* Delay function */ unsigned int cnt; unsigned int val; AD0CR |= 0x01200000; /* Start A/D Conversion */ do { val = AD0DR; /* Read A/D Data Register */ } while ((val & 0x80000000) == 0); /* Wait for end of A/D Conversion */ AD0CR &= ~0x01000000; /* Stop A/D Conversion */ val = (val >> 6) & 0x03FF; /* Extract AIN0 Value */ } printf ("\nAIN0 Result = 0x%03X", val); /* Output A/D Conversion Result */ }
This program works flawlessly. What I needed is to give some analog value in debug mode. I know that it can be done using signal function but I don't know how to do it??
I recommend to take advantage of the example projects that are offered with MDK-ARM V5.18a: www2.keil.com/.../install
As an example: The LPC1700 example project "Demo" is offered by the PackInstaller: www2.keil.com/.../
This project also demonstrates the usage of a potentiometer: http://www.keil.com/support/man/docs/mcb1700/mcb1700_to_poten.htm
Do you understand my question??Sorry if u didnt. Actually I want to give some value automatically in debug mode (i.e Software Simulation). I hope this can be done by the help of signal functions. But unfortunately I don't know how to use it.
The simulator has "registers" that corresponds to the individual ADC channels.
So you write values to these registers in the simulator script, which will make the simulated ADC perform a "conversion" and return this value.