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,Make your code to wait

Hi,Make your code to wait

|

Microcontroller › PIC › How to Connect a reed sensor to a PIC24 or any PIC? › Hi,Make your code to wait

November 22, 2013 at 1:14 pm #10638
AJISH ALFRED
Participant

Hi,

Make your code to wait till the switch open like the following;

 

while(1)
{
while (TRISAbits.TRISA0 == 0); //wait till Switch on reed 1 opens    
TMR1 = 0;
PR1  = 0;
 
while(TRISAbits.TRISA1 == 0) //wait till Switch on reed 2 opens
PR1  = time1;
 
 
while(TRISAbits.TRISA1 == 0) //wait till Switch on reed 2 opens
TMR2 = 0;
PR2  = 0;
 
while(TRISBbits.TRISBO == 0); //wait till Switch on reed 3 Opens 
PR2  = time2;
 
}
 
I hope this may work!!

RSS Recent Posts

  • PCB manufacturing issues April 18, 2026
  • Bot checks April 18, 2026
  • Convenient audio FFT module? April 18, 2026
  • SDCC Array Access In Timer 0 Interrupt Handler April 18, 2026
  • Assistance locating a 'trail' camera gadget, please ? April 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