1

I searched around much to glow the LED on pressing PUSH Button in Proteus . But LED glows on its on and do not turn Off on pressing Push Button in Proteus. I am working on Simulation with PIC18F2455 and here is the MicroC code.

void main() {

 TRISB.B0=1; //input button
 TRISB.B7=0; //output

 while (1)
 {

   if( PORTB.B0 == 0 )
   {
     PORTB.B7=1;   
   }
   else
   { 
     PORTB.B7=0;  
   }

 }     
}
ckruczek
  • 2,361
  • 2
  • 20
  • 23
Nabeel Raza
  • 71
  • 1
  • 8

1 Answers1

0

Nabeel: Based on your post it looks like you might not have hardware design properly which changes the status of Push Button Pin when you press it. You mention that LED glows right away then there can be wrong connection either with switch or with LED.

Please refer this circuit diagram:- Reference Design

This is for AT89S51 but you can see how pull-up is connected with Push button Input pins S1 and S2.

HallMark
  • 101
  • 9
  • HallMark thank you for your response. I tried your circuit for the push button but still it glows irrespective the state of push button and remain ON .. it behaves as there is nothing connecting for the input. But the Input pin turns red telling that some current is coming inside – Nabeel Raza Aug 03 '16 at 06:32
  • can you tell me is there issue with Proteus when using PIC18f2455??Do i have to setup some configuration ? I had done work with arduino and push buttons do not cause problem when connected with arduino simulation – Nabeel Raza Aug 03 '16 at 06:33
  • Nabeel: If you can share your Proteus design then I will give a try to look in more detail about connections. – HallMark Aug 03 '16 at 07:57