what's wrong with code?

Thread Starter

yasir_66

Joined Jun 25, 2009
71
hello friends,

i built a program on pcwhd ccs compiler for simple three leds.After checking the program on Proteus 7.4 sp3 the problem is that i programmed it such that if i press push button(s1==) then led should turn on but on proteus 7.4 pro the leds are working without pressing push button

here is code;

Rich (BB code):
#include<16f877A.h>
#fuses NOWDT,HS,NOLVP,NOPROTECT
#use delay(clock=20Mhz)
#bit l1=5.0
#bit l2=5.1
#bit l3=5.2
#bit s1=6.0
main()
{
set_tris_a(0b000000);
set_tris_b(0b11111111);
l1=l2=l3=0;
while(1)
{
if(s1==0)
{
l1=1;
delay_ms(100);
l1=0;
delay_ms(100);
l2=1;
delay_ms(100);
l2=0;
delay_ms(100);
l3=1;
delay_ms(100);
l3=0;
}
}
}
 
Last edited:
Top