Problem reading limit switches
Jim C.
Posts: 8
I am using a BS1 to control a home built garage door opener. I went with a Stamp because I wanted to read a pulse encoder and determine if the door had stopped before tripping the full travel limit switches. The program is very simple but I have a problem with the speed of the program. The door runs on for several hundred milliseconds after the limit switched are made. If I bypass the encoder code [pulse in] then the door stops instantly. So it appears as though the code to read the encoder and detect if there are no pulses is very slow. Did I write it wrong or is this normal?
Here is the code:
Here is the code:
Comments
You have stated RPM = W3 for a SYMBOL,But You use W2 in Your code.(typo)
'
Try
" SYMBOL RPM = W2 "
'
I would send W2 to the DEBUG window with out the MAX 590 and look at its value.
I don't have a BS1 to try this out on,So its trial and error.
'
Hope this helps.
'
P.S.-Next time save Your code as a "txt" file. This is what the BSnxxx Stamp editor uses.This will make it easier for other's to take a quick look at Your code and give You some feed-back on it.
@Jim: You are using PULSIN to read your encoder, which will give you the duration of a high pulse on pin7 IIRC. If your encoder isn't hooked up properly and working, then the Stamp will just sit there and wait up to 655 ms, per http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/vol1/col/nv21.pdf
That may explain your overshoot. Make sure your encoder is getting a good signal into your stamp.
And I don't need to tell you that DEBUG statements slow program execution to a crawl on a BS1.
Well you put me in the correct direction. The problem was the pulses going to the BS-1. I put a scope on them and they were erratic. So I cleaned them up and now all is well. I would guess that the Stamp just went out to la la land with the erratic pulse train. Thanks for the tip.
Jim