Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 803365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T23:44:56+00:00 2026-05-14T23:44:56+00:00

The connection is as follows An infrared sensor circuit which yields 0 or 5v

  • 0

The connection is as follows An infrared sensor circuit which yields 0 or 5v depending on closed or open circuit output line to port 2_0 pin of microcontroller 8051 philips.Problem is when i do this the circuit value are overridden by the current value on port 2_0 led always goes on.Here is my code(in keil c) i guess i have not configured P 2_0 as input properly

void MSDelay(unsigned int);

sbit led=P1^0;

void main()
{
    unsigned int var;
    P2=0xFF;
    TMOD=0x20;
    TH1=0xFD;
    SCON =0x50;
    TR1=1;

    while(1)
    {
        var=P2^0;
        if(var==0)
        {  
             led=1;
             SBUF='0';
             while(TI==0);
             TI=0;
             MSDelay(250);
        } 
        else
        {   
            led=0;
            SBUF='9';
            while(TI==0);
            TI=0;
            MSDelay(100);
        }
    }       
}

EDIT : I was facing a problem since the 8086 processor i was using had a fault in it. Would recommend anyone trying this to get a few spares when programming.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T23:44:57+00:00Added an answer on May 14, 2026 at 11:44 pm

    jschmier has a good point. Also the port may not be configured correctly, or is there something in the circuit that is causing the led to toggle off and on very quickly so it looks like it is on all the time.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting this error when trying to open the connection in code as follows:
Generally we esablish a connecton in ASP as follows set conn=Server.CreateObject(ADODB.Connection) conn.Provider=Microsoft.Jet.OLEDB.4.0 conn.Open(Server.Mappath(/db/northwind.mdb)) set
I have code to run sql query in ruby as follows sql = ActiveRecord::Base.connection()
Note - this follows my question here: JDBC: Does the connection break if i
We have a different set of connection strings in our config file as follows.
From the Play! API it follows that a database connection can be made with
My connection code is as follows: String appId = Facebook.FacebookApplication.Current.AppId; var oauth = new
I have doubt using jpa. I defined the datanucleus connection for MYSQL as follows.
I have a batch script that invokes PLSQL with connection details, which works fine
I have an object like follows: @connection.register class User(Document): __collection__ = 'users' __database__ =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.