NPN proximity switch interface to 89c51

Status
Not open for further replies.

eshan7

Newbie level 3
Joined
Mar 27, 2010
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,299
I have to interface an NPN proximity switch to uC 89C51...

Please help me with a schematic on how to connect the sensor and how to code it..

The sensor is NPN and takes 5 to 24V input supply. And it gives the same at o/p..
 

The attached picture shows connection between a proximity sensor and 8051 microcontroller without isolation via. Interrupt_0 pin ..

These switches have usually N/O [normally-open] output, that is when nothing is in the proximity of the sensor the output is in high-impedance stage and the voltage is determined by the pull-up [4.7k] resistor ..

On power-on the 8051-derivative has the Interrupt_0 active on the falling edge, so when something triggers the sensor the voltage drops down and the Interrupt_0 will become active ..

In the beginning of your code define a flag as:
Code:
Flags		DATA	20h
Proximity_1	BIT	Flags.0

And then set it in the ISR[Interrupt Service Routine]:
Code:
Int_0:
	SETB		Proximity_1
	RETI

Rgds,
IanP
 

    eshan7

    Points: 2
    Helpful Answer Positive Rating
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…