Scans through the D/A converter values, and copies a set of A/D converter readings to a file on USB local filesystem. Connect pin 18 to pin 17.
Diff: main.cpp
- Revision:
- 1:d9d6cf136120
- Parent:
- 0:4414657a2618
diff -r 4414657a2618 -r d9d6cf136120 main.cpp --- a/main.cpp Tue Dec 07 05:31:04 2010 +0000 +++ b/main.cpp Fri Dec 10 05:56:45 2010 +0000 @@ -11,15 +11,15 @@ int i; int n; unsigned short x[N]; -short trim = 3; // ADC trim; appears this is added to the ADC readings (i.e, -8 gives results in too low readings, 0 gives about correct readings, +3 gives really correct readings for my system, and +7 gives too high readings.) +//short trim = 3; // ADC trim; appears this is added to the ADC readings (i.e, -8 gives results in too low readings, 0 gives about correct readings, +3 gives really correct readings for my system, and +7 gives too high readings.) int main() { FILE *fp = fopen("/local/out.txt", "w"); // Open "out.txt" on the local file system for writing - LPC_ADC->ADTRM&=~0x00F0; //zero the ADC trim bits - LPC_ADC->ADTRM|=(trim<<4) & 0x00F0; //set the trim - LPC_SC->PCONP &= ~(1<<30); - LPC_SC->PCONP &= ~(1<<10); - LPC_SC->PCONP &= ~(1<<27); + //LPC_ADC->ADTRM&=~0x00F0; //zero the ADC trim bits + //LPC_ADC->ADTRM|=(trim<<4) & 0x00F0; //set the trim + //LPC_SC->PCONP &= ~(1<<30); //optionally power down various parts of the lpc1768 + //LPC_SC->PCONP &= ~(1<<10); + //LPC_SC->PCONP &= ~(1<<27); for (i=0;i<1024;i++) { aout.write_u16(i<<6); wait(0.001);