Measuring the Output of a RS-232 Serial Port for Low Level Analysis
Overview
RS-232 serial ports output their information along one transmit line (Pin 2), at a specific baud rate. To analyze the signal as it's being transmitted over the line, you can use one of our acquisition devices to view the actual signal being transmitted.
Signal Measurement
Normally we're not concerned about the voltage levels of the serial port, but to see the actual signal the device is receiving, you may use the following method to observe the output of the serial port. One thing to be careful about is not to input a serial signal that uses a voltage level that goes beyond the analog input limit of the DAQ card.
The only two pieces of hardware that you would need is your serial port, and a data acquisition device. Take pin 2 of your serial port, which is your transmit line, and wire it into any analog input of the data acquisition device.

To create a cleaner look to the input of the signal, you may wish to enable reference triggering for your data acquisition. In DAQmx, this can be found in the task timing palette when creating a task, or using DAQ Assistant.

To get the timing correct, it's important to know the baud rate of your signal, and you can specify the rate of your data acquisition to be 100 times that of the baudrate to have 100 samples per bit. In the Reference Trigger image included above, the Pre-Trigger Samples is set to 100 to leave 1 bit of empty space before the data acquisition begins.
Below are included some examples of different Hex Values represented in serial, and a working serial port will show the bits represented as such. Something to notice in the images below is that the very first bit is 'S' which is the start bit. The following 8 bits are the binary representation of the value being passed through with the least significant bit on the left. The last bit is the stop bit represented by 'S', and it will remain low for the amount of bits specified. In these examples the duration of 1 bit was used for the stop bit.
Example Signals

The hex value written is 00 which represents the binary value 00000000. In serial, all the 0's are represented as a positive voltage and all the 1's are represented as a negative voltage.

The hex value written is 01 which represents the binary value 00000001. From the image above, we can see that the lowest significant bit is the first bit to pass through, and is the furthest left on the signal.

The hex value written is 55 which represents the binary value 01010101. This value can be used to visually distinguish each bit value that is passed through.
Reader Comments | Submit a comment »
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).
