> Just a quick question on hooking up PICs to RS-232 Lines. I've seen > a few applications (the classic being the BASIC STAMP) that connects > a PIC directly to the RS-232 Lines of a host computer. > I presume that it would work because of the low currents involved and > the fact that RS-232 "0" can be represented by 5V. Does this mean that > a 1 is anything less than 3V (which is what i believe the EIA Spec says). RS232 specifies transmitter outputs be +5 to +25V or -5 to -25V. Receiver inputs are +3 to +25V or -3 to -25V. The range between -3 to +3V is to be ignored (for noise rejection). Practically, lots of receiver chips incorrectly accept input signals around 0V as a valid logic 1 signal. RS232 is a voltage interface, so you should not expect to draw any current. Again, practically, you can probably draw a few milliamps without damaging anything or degrading the signal too badly (depending on the transmitter output stage). Following are details (excerpted from my post of 11-29). With asynchronous serial, the data is sandwiched in between a start bit and a stop bit. Normally, there are 8 data bits between as in the following diagram: +V logic 0 spacing on !---:''':''':''':''':''':''':''':''': ! : : : : : : : : : -V logic 1 marking off ---! :...:...:...:...:...:...:...:...:---: Start 0 1 2 3 4 5 6 7 Stop RS232 specified the physical properties of the interface. This includes voltages. At the transmitter, logic 0 or "spacing" is +5 to +25V while logic 1 or "marking" is -5 to -25V. Marking and spacing are terms that date back to Teletype days. RS232 receiver must accept -25 to -3 or +3 to +25. Range between -3 and +3V is supposed to be used for hysteresis to reject noise. Lots of receiver chips do NOT handle the -3V to +3V range correctly. Their rejection band is about 1/2 a volt somewhere around 0V. Note that the transmitter side minimum output is specified as a higher voltage than the minimum specified at the receiver to allow resistive drop in the wire. Also, it's a 1-wire voltage based interface, so you need a ground wire. And be carefull of current flows between the equipment on the ground wire -- particularly if the two ends are located some distance from each other. Normally an async RS232 data line is idle and marking (-5 to -25V). A status line, such as Data Terminal Ready (DTR, DB25 pin 20) or Request To Send (RTS, DB25 pin 4), will be asserted (ON, +5 to +25V). When a character is transmitted, the start bit guarantees a low to high transition (from marking to spacing). The stop bit is used to guarantee that (irrespective of the data) in a continuous stream of characters, the line will be driven back down to the marking state before the next start bit is sent. The "baud rate" is the number of bits per second when the line is running continuously. The difference between bits per second and baud rate is that baud rate may vary from 0 bps to maximum. Thus the baud rate is the correct term for an async line while BPS (bits per second) is correct for a sync line. [Misuse of this term is a pet peeve of mine.] Data is sent least significant bit first. Lee Jones ------------------------------------------------------------------- Jones Computer Communications lee@frumble.claremont.edu 509 Black Hills Dr, Claremont, CA 91711 voice: 909-621-9008 -------------------------------------------------------------------