Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Pic16f877a push button

Status
Not open for further replies.
Joined
Apr 8, 2012
Messages
201
Helped
3
Reputation
6
Reaction score
2
Trophy points
1,298
Activity points
0
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.


Code Basic4GL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
main:
     TRISB = $FF
     TRISD = $00
     PORTB = 0
     PORTD = 0
        
     while(1)
 
 
         if(Button(PORTB, 0, 10, 0)) then
            PORTD.0 = 1
         end if
        
         if(Button(PORTB, 1, 10, 0)) then
            PORTD.0 = 0
         end if



wend
 
Last edited by a moderator:

i have worked in mikro C not in this IDE.
But i think it is not necessary to make PORTB=0; as it is not a output port. remove it and check.
 

My guess is that you need to disable the watchdog timer in configuration settings (edit project)
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top