Build a serial RS-232 receiver with a voltage comparator.
Posted by benoit on 18 Oct 2006 at 05:08 pm | Tagged as: embedded
If you like low-level stuff, this is for you. A micro-controller with a built-in voltage comparator can be used for a cool little hack: use the comparator as a RS-232 serial receiver without the need for a RS-232 to TTL adaptor.
For those of you unfamiliar with what I just said, here’s a little primer. Most microprocessors with I/O pins support TTL: 0V is negative, 5V is positive. RS-232 (aka your PC’s serial port) specified that -15V to -3V is positive (a mark) and +3V to +15V is negative (a space). Incidentaly, most PC implementations will actually not meet that spec as a mark is only about -1V.
How does the little hack work? Connect the RS-232 RX pin to the Voltage Comparator Pin on your microprocessor. Set the reference voltage to be about 3V. Depending on your particular, anything above 3V will be considered a 1 and bellow 3V will be a 0. Hook-Up an Interrupt Service Routine to read the comparator output and bit-bang read the bytes. Note that only fairly slow baud rates is supported with bit banging; 19,200 bauds is the upper limit with this technique.
Why would you ever want to do this? Small physical package, with no spare circuit board space is one possible reason…
Leave a Reply
You must be logged in to post a comment.