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 / Topics / Serial communcation using 8051

Serial communcation using 8051

|

Microcontroller › 8051 › Serial communcation using 8051

  • This topic has 2 replies, 3 voices, and was last updated 11 years, 9 months ago by Ashutosh Bhatt.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • August 23, 2014 at 10:34 am #3213
    NIVESH SHARMA
    Participant

    Sir I am using a switch on P2.0. when switch off A is transmit infinite times and whent it is off B is transmit infinite times but i want to transmit only one time,what changes i will do in code. 

    August 24, 2014 at 6:28 am #12065
    AJISH ALFRED
    Participant

    Hi,

    did you mean “P2.0. when switch ON A is transmit infinite times and whent it is OFF B is transmit infinite times”.

    You have written “off” only !!

     

    What you can do is once an ON condition is detected send A and wait till the condition becomes OFF, and once it is OFF send B and wait till the ON condition is detected. Repeat this in a loop.

     

    The following code is just to give you an idea;

     

    while ( 1 )

    {

        while (OFF); // wait till ON is detected, the condition fails and go to next statement

        sendA ();

        while (ON);  // wait till OFF is detected, the condition fails and go to next statement

        sendB ();

    }

    August 25, 2014 at 7:24 am #12072
    Ashutosh Bhatt
    Participant

    you have to give key debounce delay after key is pressed. then send A once and enter in continuous loop that will send B only once and do nothing till key is pressed again

     

     

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Log In

RSS Recent Posts

  • Battery discharger May 20, 2026
  • Relay question May 19, 2026
  • Phone Charger 5v to 12v May 19, 2026
  • reviving old swordfish program but? May 18, 2026
  • Assistance locating a 'trail' camera gadget, please ? May 18, 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