Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Motor status based on moisture sensor using 8051

Status
Not open for further replies.

sujeethaa

Junior Member level 3
Joined
Nov 18, 2012
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
bangalore
Activity points
1,464
hi all

<60=motor on
>75=motor off
bet 60 to 75 = previous status

how can i write the c code for this status

thanks in advance
 

see this link https://www.edaboard.com/threads/272349/

Code:
#define MOTOR PORTB.0

unsigned int adc_val;
unsigned int prev_state;

if(adc_val < 60) {

	MOTOR = 1;
	prev_state = 1;
}
else if(adc_val > 75) {
	
	MOTOR = 0;
	prev_state = 0;

}
else if((adc_val >= 60) && (adc_val <=75)) {
	MOTOR = prev_state;

}
 
Last edited:

What are 60 and 75? Are they relative humidity? Which moisture sensor are you using?
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top