thanks cncmachineguy! the code posted above works i just change the byte variable into a word and i can time upto my requirements
however i have another similar project that is having problem, the code is:
Code:@ DEVICE pic16f877a,WDT_ON, PWRT_ON, BOD_ON DEFINE OSC 8 define ADIN_RES 10 DEFINE ADC_BITS 10 DEFINE ADC_CLOCK 3 DEFINE ADC_SAMPLEUS 50 TMP VAR word SLM var word delay var word COUNT1 VAR word ' COUNTER FOR PORTD.5 TRISA = %00000011 TRISB = %00000000 TRISD.0 = %0 TRISD.1 = %0 ADCON0 = %11000101 ADCON1 = %10000000 COUNT1 = 0 START: delay = 0 ADCIN 0 , SLM ADCIN 1 , TMP delay =((tmp * (46/200)) + 8)*384 if tmp =< 30 THEN DELay = 3625 ELSE IF tmp => 80 THEN delay = 10244 ELSE delay = 384 * ((tmp * (46/200)) + 8) / 2 ENDIF ENDIF IF(PORTb.5=1) AND (COUNT1<delay) THEN skip1 IF SLM => 621 then high PORTb.5 else low PORTb.5 endif COUNT1 = 0 SKIP1: pause 20 COUNT1 = COUNT1 + 1 GOTO START
i need to vary the output delay based on the ambient temperature, but the result is inaccurate





Bookmarks