|
||||||||||||||||||||||||||||
|
Measuring and analyzing RS232 signals
Contents
|
|||||||||||||||||||||||||||
| setting | value |
| bit rate | 110 |
| data bits | 8 |
| parity | None |
| stop bits | 1 |
| data transport control | None |
Text typed in the terminal program should now be transmitted directly through the serial port.
Setting up the hardwareFirst the Handyscope HS4 is connected to the computer and the Multi Channel software is started.
Now connect Ch1 to the TxD line of the COM port of the computer. Connect the ground terminal of the input to CG (chassis ground) of the COM port.
COM ports use either a 9 pin or a 25 pin male Sub-D connector.
| signal | 9 pin | 25 pin |
| TxD | pin 3 | pin 2 |
| RxD | pin 2 | pin 3 |
| CG | pin 5 | pin 1 |
Setting up the software
Setting up the input channelsSince only one channel is used to measure the RS-232 signal, Ch2, Ch3 and Ch4 of the Handyscope HS4 are removed from the screen.
We are using Ch1 to measure the Transmitted Data (TxD). To simplify recognition of the signal, it can be given a descriptive name (alias). To change the alias of a channel, right-click the channel in the object tree and select Set alias... and enter the required alias. Give Ch1 the alias "TxD".
RS-232 signals lie between -12 Volt and +12 Volt, idle state = -12 Volt. Therefore, set the channel input coupling of the channel to "DC" and set the input sensitivity of the channel to "20 Volt" full scale. That way both signal levels can be measured properly.
Setting up the time baseIn our example, a 110 bit/s serial communication is used. Therefore, set the time base to a sampling frequency that is ten times higher, 1 kHz. Since we will be typing text in a terminal program, we need sufficient measuring time, e.g. 2 seconds. With a sampling frequency of 1 kHz, that requires 2000 samples record length.
Setting up the triggerIn idle state, the TxD line has a logic "1", which means that the voltage on the line = -12 Volt. When communication starts, first a start bit, a logic "0" (+12 Volt) is transmitted. That means that the start of a communication sequence is a rising edge. Therefore, set the trigger type to rising edge. The trigger level and trigger hysteresis are not really important, as long as they are within the -12 .. +12 Volt range. Set the trigger level to e.g. 50% and the hysteresis to e.g. 2.5%. To make sure that the measurement is only started when the communication begins, the trigger timeout has to be set to infinite.
Setting up the Serial analyzerTo analyze the RS-232 signals, the serial analyzer sink is used. Create one by right-clicking Sinks in the object tree and selecting Serial analyzer. This also opens an additional window, which will display the analyzed RS-232 communication.
The serial analyzer can handle up to eight serial communication signals, but in our example, only one signal will be analyzed. Connect Ch1, TxD, to the serial analyzer by dragging it on the serial analyzer sink in the object tree.
Port settingsClick on the Settings tab to setup the port settings for the analyzer.
The serial analyzer can analyze serial signals from multiple sources. Sources that are connected will initially get default values. These default values can be changed by selecting Default in the Source selector. Settings for sources that are already connected can be selected as well. Our example uses TxD as source, so select that.
Bit rateThe serial analyzer can determine the bit rate of the measured signal automatically. However, it requires at least 25 edges in the measured signal, meaning that the communication must be long enough, at least 4 to 5 characters of transmitted data. The Analyzer can also be set to a fixed bit rate. In that setting, the analyzer will immediately start analyzing the data, using the preset bit rate. In our example, a bit rate of 110 is used. Set the bit rate of the analyzer to 110.
Data bitsSerial communication can use various numbers of data bits per transmitted "word". In our example, a 8 data bits are used. Set the number of data bits of the analyzer to 8.
ParitySerial communication can use different kinds of parity checks to verify the correctness of the transmitted data. In our example, no parity is used. Set the Parity of the analyzer to None.
Stop bitsSerial communication can use different numbers of stop bits to indicate the end of a transmitted "word". In our example, 1 stop bit is used. Set the number of stop bits of the analyzer to 1.
TypeWith normal serial communication, a logical "0" is represented by a high voltage and a logical "1" by a low voltage. Sometimes this is inverted, a logical "1" is a high voltage and a logical "0" a low voltage. In our example, we use standard RS-232, so set Type to Normal.
Mid levelWith normal serial communication, all levels above mid level are considered a logical "0" and all levels below mid level are considered a logical "1". The analyzer can detect a mid level based on the measured data or the user can set a voltage that will be used as mid level. Usually, Auto level will do, so set Mid level to Auto level.
Ready to measureNow everything is properly setup, type a word in the terminal program to create a serial communication. The instrument will capture this communication and the serial analyzer will analyze and decode it.
In our example, the word "tiepie" was typed and measured and converted by the serial analyzer. The settings that were used are displayed above the decoded part of the communication.
To clear the Serial Analyzer output window for a new measurement, press the Clear text button
.
When a block of communication is longer than the Serial Analyzer output window, it is not possible to see all text
that is appended.
The window has an auto scroll function, which always makes sure the bottom lines are visible.
To toggle this function, click the Auto scroll button
.
To save the contents of the output window to a file, press the Save button
.