EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Replies / hi dude i already uploaded a

hi dude i already uploaded a

|

Microcontroller › 8051 › interfacing ir sensor with 8051 › hi dude i already uploaded a

April 13, 2012 at 9:17 am #7431
D.V.G. Krishna
Participant

hi dude

 

i already uploaded a link that discribes the working of IR sensor

 

if you are using 8051 micro controller

to diclare the pin as input tha last thing written to the port must be “1”

if you want to make all pins of port1 as in put you need to write P1=0xff;

 

the sensor you showed in the link may not work properly.use the comparator circuit as shown in the following link which i already posted in previous post

 

the logic will be as follows

 

    #include<reg51.h>

 void main()

{

  P1=0xff ;   // all pins of port1 are diclared as in put

 //asume that the sensor is connected to pin P0.0

// assume sensor gives high on detecting an object

   while(1)

{

    if((P1 & 0x01)==0x01) // bit masking to check for only P0.0

     P2=0xff; // switches on the LED connected to port2 if the sensor dectects  an object

    else

    P2=0x00;//  LED off

}

}

 

RSS Recent Posts

  • Voltage comparator circuit verification May 10, 2026
  • What is this??? May 10, 2026
  • Why aren’t the power windows in my 2006 Volkswagen Polo 2006 working despite repairing the control unit circuit board? May 10, 2026
  • infiniBand Layer 1 specifications testing question May 8, 2026
  • block RF May 8, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise