I am using the USB-TTL Interface Module to connect my development computer to my
Z-24 application board.
This is sort of a philosophical question concerning the labling of the various connections. The board edge is labeled Gnd, DTR, TxD and RxD. As I understand the world, Tx means transmit and Rx means Receive. I am always confused as to the meaning of transmit and receive. Transmit to where (which direction). Receive from where (which direction). My connection is between a PC and the ZX-24's serial port 1. In my way of thinking, this is computer to computer. My little cheat sheet on the meaning of Tx is from computer to modem and Rx is from modem to computer.
Is there a simple way to understand how to wire up a serial connection without all the computer to modem and modem to or DCE to DTE computer mumbo-jumbo? For once I would like to wire up some serial interface between, say, a ZX-24 and something without the stress of worrying about what wire goes to where. Please straighten me out.
Any enlightenment will be appreciated.
Vic
Help! Series connections
Help! Series connections
Vic Fraenckel
KC2GUI
windswaytoo ATSIGN gmail DOT com
KC2GUI
windswaytoo ATSIGN gmail DOT com
Typically, the Tx and Rx labels are from the perspective of each device so each device sends on the Tx line and receives on the Rx line. Clearly, then, the Tx of one device must be connected to the Rx of the other in order for them to communicate.
The remaining lines (RTS, CTS, DTR, DSR, DCD) are labelled with respect to their function. Whenever a pair of devices communicate using the RS-232 protocol, one of them plays the role of DTE (Data Terminal Equipment) and one plays the role of DCE (Data Communication Equipment). The DTE device is responsible for outputting the DTR and RTS signals while the DCE device outpus CTS, DSR and DCD. The DTE/DCE role also dictates which device transmits on pin 2 and receives on pin 3 of the DB connector.
The remaining lines (RTS, CTS, DTR, DSR, DCD) are labelled with respect to their function. Whenever a pair of devices communicate using the RS-232 protocol, one of them plays the role of DTE (Data Terminal Equipment) and one plays the role of DCE (Data Communication Equipment). The DTE device is responsible for outputting the DTR and RTS signals while the DCE device outpus CTS, DSR and DCD. The DTE/DCE role also dictates which device transmits on pin 2 and receives on pin 3 of the DB connector.
- Don Kinzer
Hello Vic,
Welcome to the world of RS-232...
As you begin working with serial communications it is worth noting that for many applications ONLY the Ground, Tx, and Rx are needed, and you may not need to work with the handshake signals at all.
This certainly simplifies both the hardware, and the software.
For low speed links, and small amounts of data flow, this is reasonable.
The handshake signals become particularly useful when you are running your communications routines in the background, on an interrupt driven nature. It helps to maximize your data throughput.
That said, I have lots of Basic Stamp, PIC, and ZX devices that communicate either with a PC, or other devices, with just Tx, Rx, & Gnd.
Also, it is important to understand that a PC serial port uses RS-232, which is a bi-polar signal. I don't have the formal spec at hand, but typically the actual signal on the Transmitted Data line is either -12 V or + 12 V, (range about -7.5 to - 15, to + 7.5 to + 15) for the 1's and 0's. There is a dead band in between, say -7.5 to +7.5 V that does not represent anything.
The ZX puts out a serial data string of 1's and 0's, Highs and Lows, which is 5 V and 0 volts. For the ZX to talk to a true RS-232 serial comm device, you typically run your ZX (0/5 V signal) through a Max 232 chip (or equivalent) to convert the signal to a +/- 10 volt signal to send over your cable.
This chip also converts the incoming data from the PC (+/-12 V) back to 0/5 V level signal for the ZX to use on it's receive line.
Note, also, that the "Line Drivers", (Max232, etc), also invert the polarity of the signal, which doesn't matter as the line driver at the other end re-inverts it. Useful to know, however, if you are monitoring the line on a scope or logic probe.
Many laptops, and some other devices, cheat on the RS-232 spec, and do not use a true bipolar transmission signal. They use Gnd and +12 V, instead of -12 and +12 V, for example. Frequently it works, frequently it is problematic. It saves the device needing to generate a true negative voltage.
Note that setting up your comm parameters, eg 9600, N, 8, 1; is totally independent of the hardware side of the system, discussed above. Both devices need to use the same baud rate, parity, start and stop bit parameters, and both need to use either true or inverted logic.
Also, note that for short distances the "line drivers" are not required at all. You can send the 0/5 V serial signals between devices, too, (say between to micros). Both devices, however, have to either be using TTL level serial, or true RS-232 bi-polar signals, do not connect an RS-232 bipolar signal directly to the Zx inputs.
Lastly, note that if you are interfacing to a commercial device, with builtin RS-232, you may or may not have to worry about the handshake signals. Many devices do not implement them. At times you may need to either implement them, or fool the device into thinking that they are implemented.
For debugging, do not forget that Windows has Hyperterminal (Accessories), which allows you to easily change the port, and comm parameters, to look for data on the serial line, such as your ZX send the message "Hello World"...
JC
Welcome to the world of RS-232...
As you begin working with serial communications it is worth noting that for many applications ONLY the Ground, Tx, and Rx are needed, and you may not need to work with the handshake signals at all.
This certainly simplifies both the hardware, and the software.
For low speed links, and small amounts of data flow, this is reasonable.
The handshake signals become particularly useful when you are running your communications routines in the background, on an interrupt driven nature. It helps to maximize your data throughput.
That said, I have lots of Basic Stamp, PIC, and ZX devices that communicate either with a PC, or other devices, with just Tx, Rx, & Gnd.
Also, it is important to understand that a PC serial port uses RS-232, which is a bi-polar signal. I don't have the formal spec at hand, but typically the actual signal on the Transmitted Data line is either -12 V or + 12 V, (range about -7.5 to - 15, to + 7.5 to + 15) for the 1's and 0's. There is a dead band in between, say -7.5 to +7.5 V that does not represent anything.
The ZX puts out a serial data string of 1's and 0's, Highs and Lows, which is 5 V and 0 volts. For the ZX to talk to a true RS-232 serial comm device, you typically run your ZX (0/5 V signal) through a Max 232 chip (or equivalent) to convert the signal to a +/- 10 volt signal to send over your cable.
This chip also converts the incoming data from the PC (+/-12 V) back to 0/5 V level signal for the ZX to use on it's receive line.
Note, also, that the "Line Drivers", (Max232, etc), also invert the polarity of the signal, which doesn't matter as the line driver at the other end re-inverts it. Useful to know, however, if you are monitoring the line on a scope or logic probe.
Many laptops, and some other devices, cheat on the RS-232 spec, and do not use a true bipolar transmission signal. They use Gnd and +12 V, instead of -12 and +12 V, for example. Frequently it works, frequently it is problematic. It saves the device needing to generate a true negative voltage.
Note that setting up your comm parameters, eg 9600, N, 8, 1; is totally independent of the hardware side of the system, discussed above. Both devices need to use the same baud rate, parity, start and stop bit parameters, and both need to use either true or inverted logic.
Also, note that for short distances the "line drivers" are not required at all. You can send the 0/5 V serial signals between devices, too, (say between to micros). Both devices, however, have to either be using TTL level serial, or true RS-232 bi-polar signals, do not connect an RS-232 bipolar signal directly to the Zx inputs.
Lastly, note that if you are interfacing to a commercial device, with builtin RS-232, you may or may not have to worry about the handshake signals. Many devices do not implement them. At times you may need to either implement them, or fool the device into thinking that they are implemented.
For debugging, do not forget that Windows has Hyperterminal (Accessories), which allows you to easily change the port, and comm parameters, to look for data on the serial line, such as your ZX send the message "Hello World"...
JC
Thanks for the replies.
My original question was:
I think the thing that confused me here is exactly what the terms transmit and receive are referenced to. I actually understand the electrical concepts of the signals passing back and forth. I just get confused about how the channels are referenced.
Think about this: If you have the USB-TTL attached to a PC, you might consider that the label TxD means that the signal detected on this pin is transmitted from the PC and the Label RxD means that the signal is being received at the PC.
Vic
My original question was:
dkinzer wrote:I am using the USB-TTL Interface Module to connect my development computer to myZ-24 application board.
If I understand you, if I wish to SEND TO the attached PC over the USB-TTL, I would attach the transmit channel (pin) of the ZX to the TxD pin of the Interface Module and if I wish to RECEIVE FROM the attached PC over the USB-TTL, I would attach receive channel (pin) of the ZX to the RxD pin of the Interface Module.Typically, the Tx and Rx labels are from the perspective of each device so each device sends on the Tx line and receives on the Rx line. Clearly, then, the Tx of one device must be connected to the Rx of the other in order for them to communicate.
I think the thing that confused me here is exactly what the terms transmit and receive are referenced to. I actually understand the electrical concepts of the signals passing back and forth. I just get confused about how the channels are referenced.
Think about this: If you have the USB-TTL attached to a PC, you might consider that the label TxD means that the signal detected on this pin is transmitted from the PC and the Label RxD means that the signal is being received at the PC.
Vic
Vic Fraenckel
KC2GUI
windswaytoo ATSIGN gmail DOT com
KC2GUI
windswaytoo ATSIGN gmail DOT com
I think that this is backwards. The ZX-24 transmits on pin 1 and receives on pin2. The USB-TTL transmits on the terminal marked Tx and receives on the terminal marked Rx. To make these work together, you must connect the Tx of one to the Rx of the other. The USB-TTL module is designed so that the Rx, Tx, DTR, and Ground terminals line up exactly with the ZX-24's Tx, Rx, DTR and Ground pins, respectively, so that four straight-across connections are all that is required.victorf wrote:If I understand you, if I wish to SEND TO the attached PC over the USB-TTL, I would attach the transmit channel (pin) of the ZX to the TxD pin of the Interface Module and if I wish to RECEIVE FROM the attached PC over the USB-TTL, I would attach receive channel (pin) of the ZX to the RxD pin of the Interface Module.
- Don Kinzer
I appreciate the responses that you have posted.
Here is a real world situation that is the type of thing that confuses me.
I have a Kenwood TH-D7A radio and I wish to attach it to a PC by using the USB-TTL module. The manual for the radio says that I use a 3 conductor (2.5mm) plug and connect the tip (TxD) to pin 3 of a DB9, ring to (RxD) to pin 2 of the DB-9 and Sleeve (Gnd) to pin 5 of the DB9. Does this imply I can connect tip to the module RxD, ring to the module TxD and sleeve to the module Gnd? Does TxD labeled on the module mean transmit TO the thing that is hung on the other end of the USB connector (or does it mean the device attached to the TxD is transmitting)?
Here is a real world situation that is the type of thing that confuses me.
I have a Kenwood TH-D7A radio and I wish to attach it to a PC by using the USB-TTL module. The manual for the radio says that I use a 3 conductor (2.5mm) plug and connect the tip (TxD) to pin 3 of a DB9, ring to (RxD) to pin 2 of the DB-9 and Sleeve (Gnd) to pin 5 of the DB9. Does this imply I can connect tip to the module RxD, ring to the module TxD and sleeve to the module Gnd? Does TxD labeled on the module mean transmit TO the thing that is hung on the other end of the USB connector (or does it mean the device attached to the TxD is transmitting)?
Vic Fraenckel
KC2GUI
windswaytoo ATSIGN gmail DOT com
KC2GUI
windswaytoo ATSIGN gmail DOT com
That is probably the correct connection.victorf wrote:Does this imply I can connect tip to the module RxD, ring to the module TxD and sleeve to the module Gnd?
That is the typical marking but there is no guarantee that all devices are so labeled.victorf wrote:Does TxD labeled on the module mean transmit TO the thing that is hung on the other end of the USB connector [...]?
You may be able to use a voltmeter to confirm your hypothesis. Connect the negative lead to the device's ground terminal. Then, touch the positive lead to the assumed transmit terminal. For non-inverted TTL-level devices, the voltage should be in the +3 to +5 range (for an RS-232 compliant device, the voltage should be in the -3 to -12 volt range). The receive terminal will either be floating or it will have a pullup to +5 (for non-inverted TTL-level devices) or a pulldown to ground or a negative voltage (for RS-232 compliant devices).
If the device does have a pullup/pulldown on the Rx line, the test above will be inconclusive. If you can cause the device to transmit some data, you can determine the Tx terminal by using an oscilloscope and looking for signal transitions. Since the Rx line has a pullup or pulldown there won't be any transitions on it.
- Don Kinzer