ࡱ> Root EntryR6]A MAIN  RSCOMPSTG1L&>4]A4]ACONTENTS  !"#$%&'()*+,-. WG _extentxR WG _extentyport01bit0port10bit1port23bit2port32bit3port45bit4port54bit5"yTlcdsize RSComponent LCDDisplay18F4550,0x300000,0x4 0x300001,0xc 0x300002,0x19 0x300003,0x1e 0x300005,0x81 0x300006,0x80 0x300008,0xf 0x300009,0xc0 0x30000a,0xf 0x30000b,0xe0 0x30000c,0xf 0x30000d,0x40 t= RSFlowlineMainXXK RSStartStopCmdMainRSMacroCallCmdCall Component MacroStart LCDDisplay(0)0RSInterruptCmd ADC Interrupt ADC_INTERRUPTTMR0ADC_INTADIEpie1ADIFpir1intcon.PEIE=1;  RSLoopCmdLoop1MainXX Main RSCCodeCmdSample ADC Channel 0 char cnt = 0; adcon1 = 0x0E; //Enable ADC0 Input adcon2 = 0x03; //Set ADC Sample Time trisa = trisa | 0x01; adcon0 = 0x01; //Switch on ADC while (cnt <220) cnt++; //Allow ADC Capacitor to charge / discharge adcon0 = adcon0 | 0x02; //Start Conversion Process RSCalculationCmd Calculation Calculation- 1Sample0Count While Sample Not Complete Sample < 0MainXXMain RSCommentCmdRThe variable will be set to a positive integer when the ADC has completedIncrement Counter Count + 1CountMainCall Component MacroCursor LCDDisplay(0) RSOperand010Print out Counter PrintNumber LCDDisplay(0)Count0Call Component Macro PrintASCII LCDDisplay(0)" "0Call Component MacroCursor LCDDisplay(0)000Print out ADC Value PrintNumber LCDDisplay(0)Sample0Call Component Macro PrintString LCDDisplay(0)" "0 RSDelayCmdDelay250MainMain ADC_INTERRUPTXX'Service routine for ADC Sample CompleteKk  ADC_INTERRUPTCollect Sampleadcon1 = 0x0f; //Enable Digital I/O adcon0 = 0x00; //Disable ADC Module trisa = trisa & 0xFE; //Restore Tris Registers FCV_SAMPLE = (adresh << 2); FCV_SAMPLE += (adresl >> 6);  ADC_INTERRUPTTEVariableteCOUNT3CountSAMPLE3SampleTA3taTB3tb