Thanks Darell. While I have your attention, could you please have a quick glimpse and advise me of my mistake as I am struggling with it from last many days. My code only Debugs "TIME=0 & AMBIENT=0". The voltage on both Pins is set to 2.5volts, but I am not understanding why it is outputting 0 all the time.Code:;-----------------PIC16F676---------------------------Include "modedefs.bas" DEFINE OSC 4 DEFINE ADC_BITS 10 DEFINE ADC_CLOCK 3 DEFINE ADC_SAMPLEUS 50 ;-------------CONFIGURATION FUSES SET HERE------------------------- #CONFIG ifdef PM_USED device pic16F676, intrc_osc_noclkout, wdt_on, mclr_on, protect_off else __Config _XT_OSC & _WDT_OFF & _PWRTE_ON & _MCLRE_OFF & _BODEN & _CP & _CPD endif #ENDCONFIG '---------------------------------------- DEFINE DEBUG_REG PORTC DEFINE DEBUG_BIT 5 DEFINE DEBUG_BAUD 2400 DEFINE DEBUG_MODE 0 '-------Analog Input-------------- Poten Var PortA.1 Ldr Var PortC.3 '-------------------------------------- Time Var Word Time1 Var Word Counter Var Byte Ambient Var Word ;------REGISTERS SET -------- PORTA=0 PORTC=0 TRISA = 0010 TRISC = 1110 OPTION_REG = 128 PORTA=0 PORTC=0 CMCON=7 ANSEL=000010 ADCON1=110000 ADCON0=000000 '--------------------------------------- Main: GoSub LoadTime Pause 1000 GoSub LoadLight Pause 1000 Goto Main LoadTime: ADCIN Poten,Time : Pause 10 DEBUG "TIME=",DEC Time,13,10 Return LoadLight: ADCIN Ldr,Ambient : Pause 10 DEBUG "AMBIENT=",DEC AMBIENT,13,10 Return




Bookmarks