fbpx

Interface Switch With PIC

Description

The switch is a component that connects two points in a circuit when you press it.

LED turns on when you press the button.

Hardware Required

  • Push Button.
  • Pic16f877a MicroController.

Circuit

Virtual Circuit

Code

 void main()
 {
 TRISB.F1=1;
 TRISB.F0=0;
 do
 {
 if(PORTB.F1==1)
 {
 PORTA.F0=1;
 Delay_ms(1000);
 }
 else
 {
 PORTA.F0=0;
 }
 }
 while(1);
 } 

Leave a Reply

Your email address will not be published. Required fields are marked *