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,did you mean “P2.0. when

Hi,did you mean “P2.0. when

|

Microcontroller › 8051 › Serial communcation using 8051 › Hi,did you mean “P2.0. when

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 ();

}

RSS Recent Posts

  • Need a fresh eye on my first PCB November 14, 2025
  • restarting this Christmas project November 14, 2025
  • desoldering November 13, 2025
  • Unknown, to me, electric motor fitting November 13, 2025
  • Can a small solar panel safely trickle-charge old NiMH AA batteries? November 13, 2025

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2025 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