The code for performing ADC conversion is actually contained in the appropriate FCD file for each chip (these can be found in the same directory as the FlowCode EXE). This is because different chips may use different registers for the ADC functions.
For example, the 16F88.FCD file has the following towards the end of the "code" section:
Code: Select all
ADCCapture="char ta, tb, cnt;\nadcon1 = 0x00;\nansel=0x7F;\nta = trisa;\ntb = trisb;\n#if (%a == 0)\n trisa = trisa | 0x01;\n#endif\n#if (%a == 1)\n trisa = trisa | 0x02;\n#endif\n#if (%a == 2)\n trisa = trisa | 0x04;\n#endif\n#if (%a == 3)\n trisa = trisa | 0x08;\n#endif\n#if (%a == 4)\n trisa = trisa | 0x10;\n#endif\n#if (%a == 5)\n trisb = trisb | 0x40;\n#endif\n#if (%a == 6)\n trisb = trisb | 0x80;\n#endif\nadcon0 = 0x81 | (%a << 3);\ncnt = 0;\nwhile (cnt < 220) cnt++;\nadcon0 = adcon0 | 0x04;\nwhile (adcon0 & 0x04);\ntrisa = ta;\ntrisb = tb;\nansel = 0x00;\n"
Code: Select all
char ta, tb, cnt;
adcon1 = 0x00;
ansel=0x7F;
ta = trisa;
tb = trisb;
#if (%a == 0)
trisa = trisa | 0x01;
#endif
#if (%a == 1)
trisa = trisa | 0x02;
#endif
#if (%a == 2)
trisa = trisa | 0x04;
#endif
#if (%a == 3)
trisa = trisa | 0x08;
#endif
#if (%a == 4)
trisa = trisa | 0x10;
#endif
#if (%a == 5)
trisb = trisb | 0x40;
#endif
#if (%a == 6)
trisb = trisb | 0x80;
#endif
adcon0 = 0x81 | (%a << 3);
cnt = 0;
while (cnt < 220) cnt++;
adcon0 = adcon0 | 0x04;
while (adcon0 & 0x04);
trisa = ta;
trisb = tb;
ansel = 0x00;
If you want faster acquisition timing, simply replace the "220" in the while statement with a smaller number.
Remember to edit the appropriate chip's FCD file (you will probably need to make it non-read only first). And I'd also suggest that you keep a copy of the original FCD file just in case things go wrong.
I hope this info is of help - especially to you, Jim!