Re: Electrical Issue: PIC input false triggering, Signal Noise suspected.
abecker,
are you using the same reed switches on the test bench that you have installed under the track?
if not, is it possible that the switches you have under the track are flakey? defective?
I assume you have considered vibration causing the reed switches to falsely trip.
Have you considered switching to a Hall Effect switch to detect the train passing.
As others have stated... I would put plenty of bypass capacitors, even one on the actual input line itself.
Another thought is to have your code check multiple times for positive closure of the reed switch.
something like... [caution: untested code to follow!!]
Code:
IF TrainIN = 1 THEN
PAUSEUS 100 'note this time delay should be somewhat shorter than when the train really is passing by but longer than a false trip
IF TrainIN = 1 THEN
GOTO TrainDetected
ENDIF
ENDIF
in other words determine how long the reed switch is closed when the train passes (an oscilloscope would help here) and make sure that your code requires the input to be true for longer than what a false trip would be
In developing code and testing interface circuits I find that an oscilloscope is one of the most valuable tools on my bench.
good luck
Dwight
These PIC's are like intricate puzzles just waiting for one to discover their secrets and MASTER their capabilities.
Bookmarks