internetuser2k11
Banned
Hello!
My Circuit Contains a PIC16F877A. PIN RB0 and PB1 is connected to two mom switches with pull-ups and pin RD0 is configured as output pin and is connected to a relay via uln2003a. The mikroBasic code below is not working properly. When I press sw2 the relay gets turned ON but the relay turns off after 3-4 secs. what might be the problem.
My Circuit Contains a PIC16F877A. PIN RB0 and PB1 is connected to two mom switches with pull-ups and pin RD0 is configured as output pin and is connected to a relay via uln2003a. The mikroBasic code below is not working properly. When I press sw2 the relay gets turned ON but the relay turns off after 3-4 secs. what might be the problem.
Code:
TRISA = %00011
TRISB = %00000000
while(1)
if(PORTB.0 = 0) then
delay_ms(10)
if(PORTB.0 = 0) then
PORTD.0 = 1
end if
end if
if(PORTB.1 = 0) then
delay_ms(10)
if(PORTB.1 = 0) then
PORTD.0 = 0
end if
end if
wend
Last edited by a moderator: