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.

Requesting Help for PIC 16F877 on elevator

Status
Not open for further replies.
@barry: ohh actually.. i do have resistors for my push button and reed switches before it's connected to my VDD.. it's in my original circuit but when i posted it up here.. it doesn't appear.. sorry i just realised that.. my bad.. does this answer the question for zasto? i am quite a newbie, sorry if i couldn't correctly or having problem in understanding..
 

i am not using pull down resistors.. i am using N/O push buttons and my reed switch are N/O as well... when the elevator car pass by the reed switch.. it will make the reed switch close circuit.. therefore stop the elevator at the required floor..

Pull down resistors should be placed on all your input pins and connected to Vss (GND), otherwise, as you have N/O switches/reed's, when not closed your input pins are floating. When floating, can you tell the logic state of those pins?
 

@zasto.. now i got what u mean.. thx so much.. i will try again the testing.. i guess thats the problem why my circuit is not working.. i will update u all soon.. thanks ppl
 

This is my updated circuit diagram.. can help me check whether i still made any mistake in my diagram? thank you so much =)

---------- Post added at 02:58 ---------- Previous post was at 02:49 ----------

btw.. i am using a pull up resistor.. not pull down as suggested by my lecturer.. i guess that's fine right?
 

Do you use any switch debouncing method (be it either hardware or software)?
Switch bouncing can trash almost any control algorithm. At several MIPS of operation a stupid bounce can effect in incrementing a variable few dozens of times instead of once (for example)
 

@ barry & zasto : thx for the useful information given.. i will test the circuit in uni tomorrow.. if there's still any question i will post here and hope u guys could help me by providing more information needed.. really thanks a lot..

@poorchava: what do u mean by switch debouncing method? i couldnt understand much about ur question? mind making it more simple.. sorry for that =)
 

@poorchava: what do u mean by switch debouncing method? i couldnt understand much about ur question? mind making it more simple.. sorry for that =)

kk. You can simply google for 'button debouncing', so I won't give you a lecture on that. In short terms: when you push or release the button, the ideal model would assume that logic state on an input changes rapidly from high to low (pr the other way around). In reality it doesn't have to be true (and it's not in most cases), as electrical contacts in switches 'bounce'. This means that they don't make perfect contact in an instant, but rather there can be few random transitions, which can be perceived by the MCU as button presses. In this way, the MCU can think that you actually presses a button two times or fifteen times when you really pressed it only once. Especially, that buttons and switches are physically rather slow devices, and an MCU operates at some MIPS.

As for debouncing methods they all come to the same effect: to filter away the random glitches on the MCU input. The most basic analog method is a capacitor across switch contacts and a pull-up resistor which gives a kind of a low pass filter. As for digital methods it is generally achieved by placing a lower limit on the frequency of button presses (i.e. if you are using an interrupt to check the button state, then you can disable this interrupt for 200 ms following a transition detection). This way only the first transition is counted as button press, so the bouncing effect doesn;t affect the algorithm.

I hope this put some light on that matter for you
 

@poorcha.. i'm sorry.. seriously i still dun get u.. sorry :( are u trying to say how do i make sure my button is active high or active low status?
 

Kind of... I mean that every real button has metastable states when being pushed or released. And that those metastable states can mess up your control algorythm.

Just google for 'button debouncing'
 

@poorcha: now i understand what u mean by it.. so u have any ideas how to prevent that? but the main problem now for me is.. i cant even get an output from my circuit..
 

Contact bouncing may have different consequences, depending mainly on how does your firmware work. In some extreme situations it may cause infinite loop/stack overflow/memory access fault etc.

On the other hand:
-use a proper reset circuit as suggested in Pickit 2 manual
-use 100 nF capacitors physically close to power pins of PIC
-make sure that voltages are right and that pic is not damaged
 

@poorchava: i am using pickit 2 as my programmer.. and capacitor i am using 22pF for my oscillator.. i am using crystal oscillator.. i guess that's ok right?
 

That's one thing, but i mean the circuit that you connect to your reset pin to eliminate stability issues (such as few resets after power up). You can fin it in THIS LINK on page 31. It removes most of the spikes on MCLR pin (which miht trip reset condition) as well as isolates the high programming voltage (~11-13V) from passing into the rest of the circuit through power supply line.
 

thank you guys for the useful information given :) my circuit is now success.. thanks every1 for the help, appreciate it =D
 

@poorcha: actually i duno also.. before that i havent try connect it to the circuit, den i connected it the other day.. except for a lil programming problem which i already solve it.. others was ok.. :)
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top