You might be able to get away with a simple voltage divider. Do a google search, theres a ton of info on this.A long with the simple math.
I would read the voltages from the pulses before I hooked it up to the Stamp. A 5 volt zener across the I/O pin would add some more protection along with a current limiting resister.
________________$WMc%______
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············································ BoogerWoods, FL. USA
The BS2 input pins have 'clipping diodes' on them that will 'clip' +12 volts to an internal signal of 5 volts, if (and only if) you have a 22 Kohm resistor in series to drop the current the clipping diodes have to deal with.
This is how the BS2 can recieve RS-232 signal levels (+/- 12 volts) with only a 22 Kohm resistor in series to drop the current.
Without the 22 Kohm resistor, you'll put too much current through the clipping diodes and they'll fail.
Ok, I've gat one end of a 22K resistor in pin one and the other on my 12V supply. I am trying to build a tach with the 12v supply off of one coil on the electronic ignition. I am getting random readings even before I hook up the 12v supply. Any ideas?
You get ranom readings because the pin is "floating". You should tie a 10K resistor from the pin to ground. This will ensure that the pin is LOW when your tach is not connected.
Car batteries are scary monsters. I'd put a LM7805 to get voltage down to 5V, with a rectifier (1N4001) going from V+ to the input of the regulator. Do not use large cap values, as you will disrupt your COUNT.
Of course my advice for 12V (especially automotive) interfacing is to use an opto for the isolation. But even without that a transistor or MOSFET can be used to switch an input of a different voltage depending on the voltages on either side.
Comments
A little more info would help.
You might be able to get away with a simple voltage divider. Do a google search, theres a ton of info on this.A long with the simple math.
I would read the voltages from the pulses before I hooked it up to the Stamp. A 5 volt zener across the I/O pin would add some more protection along with a current limiting resister.
________________$WMc%______
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············································ BoogerWoods, FL. USA
This is how the BS2 can recieve RS-232 signal levels (+/- 12 volts) with only a 22 Kohm resistor in series to drop the current.
Without the 22 Kohm resistor, you'll put too much current through the clipping diodes and they'll fail.
Here is the code:
Main:
SEROUT TX, LcdBaud, [noparse][[/noparse]LcdBLoff, LcdOn1, LcdCls]
COUNT Tach,1000,CoilCount
SEROUT TX, LcdBaud, [noparse][[/noparse]DEC CoilCount]
PAUSE 500
Tach=0
GOTO Main
END
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Engineering
50 72 6F 6A 65 63 74 20 53 69 74 65
·