I have two analog input, one for a humidity sensor and one for soil moisture, once the analog reading on humidity sensor falls an output is driven high, and for the soil moisture when the analog reading get's high another output is driven high and the PWM servo position is changed to open a ball valve
here's my circuit:
and my code:
the circuit and code posted above works in simulation and in actual testingCode:@ DEVICE pic16f877a,WDT_ON, PWRT_ON, BOD_ON DEFINE OSC 4 define ADIN_RES 10 DEFINE ADC_BITS 10 DEFINE ADC_CLOCK 3 DEFINE ADC_SAMPLEUS 50 RLH VAR word SLM var word position var word TRISA = %00000011 TRISB = %00000000 TRISD.0 = %0 TRISD.1 = %0 ADCON0 = %11000101 ADCON1 = %10000000 low portd.7 START: ADCIN 0 , RLH ADCIN 1 , SLM IF RLH =< 621 then high PORTD.5 else low PORTD.5 endif IF SLM => 621 then high PORTD.6 position = 100 else low PORTD.6 position = 170 endif PULSOUT PORTD.7, position pause 18 GOTO START
my problem is i need to add a delay on each outputs, like a one shot timer once an output is triggered it will wait for 30 seconds or 1 minute to turn off again, cause the pause command i think is inappropriate for my application it kinda mess my PWM timing that controls the PWM servo
Can someone please guide me on these?
TIA!


 
		
		 
						
					 
			 
			 
			 
					
					 PIC16F877A, How to add timer delays on output?
 PIC16F877A, How to add timer delays on output?
		


 Re: PIC16F877A, How to add timer delays on output?
 Re: PIC16F877A, How to add timer delays on output?
		
 
				

Bookmarks