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??