Can anyone tell me how to connect reed switch to 89c51? I directly connected the 2 ends of the swtch to vcc and ground. but the switch is not functioning properly.. on application of 5 volts..as i bring magnet near to it..internal mechanism of the swtch gets short... when i remove the magnet, it remains short, doesnt go to its original position, what to do?
check the C51 startup file. make sure the "reed switch access" option is enabled.
I havent yet connected it to the microcontroller. I am basically testing the reed switch. I have connected the 2 terminals of it to vcc and ground. and when magnet is brought near the switch, internal switch gets short which is correct. on removing the magnet, it should get open, and this is not happening... can u tell me the reason and help me
Check the Keil manuals. Search for "reed-switch". If you don't find it, it's likely not going to be a Keil related problem and therefore not a relevant question for the Keil forum.
You put it across 5V and 0V? How much current can your power supply deliver? Enough to fuse the contacts together?
I checked for the glues..there is nothing like that and i have connected one terminal to vcc and other to ground.. there is enough current.. when magnet is brought near the swtch, the contacts get short. when magnet is removed , the contacts either remain short, or they become open after a long tym..
So you used your reed switch like a nail to short between plus and ground?
Just as a nail shorted over a car battery will get very hot - hot enough that the metal starts to melt - your reed switch didn't much like being used to short your power supply. That's why there is always a resistor or some other form of load in series with the reed switch, to limit the current then the reed switch closes.
Put a 10K or 47K resistor in series, and then attach your GPIO in the middle.
there is, no more, anything like a 80c51. The variety of derivative features is so big that just stating 80c51 is totally ambigous.
anyhow, as to the above, for most derivatives, you just need to connect the switch between pin and ground. for faster response you may use a pullup resistor.
Erik
Thanks a lot all of you guyss.. My reed switch is working properly with 5v supply with a 10k resistor in series ... Thanks a lot for the help..