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

  • PIC KIT 3 not able to program dsPIC June 23, 2025
  • Fun with AI and swordfish basic June 23, 2025
  • Is AI making embedded software developers more productive? June 23, 2025
  • Microinverters and storeage batteries? June 22, 2025
  • FFC connector white June 22, 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