The Solution of Abstracting Frequencies of Time Domain Signals by ...

Yahoo! is not affiliated with the authors of this page or responsible for its content.
The Solution of Abstracting Frequencies of Time Domain Signals by Interfacing Oscilloscope to Computer The Solution of Abstracting Frequencies of Time Domain Signals
by Interfacing an Oscilloscope with a Computer
1998. 8. 14.
Sangwook Suh / Sein Electronics Co., Ltd. / Republic of Korea


Abstract In these days, there are many cases that we need to define the frequency
components of a signal to analyze the signal more accurately such as noise filtering. This
paper is a solution for analyzing the frequency components of a signal without the help of
any spectrum analyzer. We can interface oscilloscope to computer and process a frequency
analysis of time domain signals using Matlab®. At this time, the Fourier transformed
function of the time domain function is obtained as the frequency domain function, and the
frequency scales are also calculated. In this paper, Hitachi model VC-5410 oscilloscope is
used for one example. Interfacing other oscilloscopes of different models can also be
possible very easily, if only the data format is known.

Index terms Interface, Frequency analysis, Matlab®, Fourier transform, Oscilloscope





The author graduated from the Department of Electrical Engineering in Seoul National University, Seoul,
Korea. And now he is with Sein Electronics Co.,Ltd.

1 I. Introduction


In these days, there are many cases that we need to define the frequency components of a
signal to analyze the signal more accurately. Also, when we want to filter a noise, we are
required to know the frequency components of the noise. For this reason, we might need a
spectrum analyzer to abstract the frequency components of a signal.
This program is a solution for analyzing the frequency components of a signal without
any spectrum analyzer. We can interface a oscilloscope ( Hitachi model VC-5410 ) to
Matlab® installed computer and process a frequency analysis of a time domain signal. And
interfacing other oscilloscopes of different models to Matlab® can also be possible very
easily, if only the data format is known. So, it is possible to use a oscilloscope not only for
the time domain analysis but also for analyzing the spectrum of the signal.












2 II. The algorithms of the programs

1.

Inter1.c
The file inter1.c is a transmitting program for interfacing the oscilloscope to computer.
The transmit configurations are set to be 4800 baud rate, no parity bit, 1 stop bit, and 8
transmitting data bits.
At first, it will initialize the transmitting port and open the file data1.dat. Then the
computer will receive signals of the mark/space message at each cell of the LCD by 8 bits (4
cells : In case of VC-5410, each 2 bits data have a information of 1 plotting cell.) from the
oscilloscope and save them to data1.dat in hexadecimal notation. And each 2 bits have the
mark/space message of 1 cell. The data saved in the file data1.dat are compounds of 0, 3, c
and f in hexadecimal notation.
The meanings of the data received are given as < Fig.1 >.
( : mark , : space)
Hexadecimal Binary
Mark/space
signal
0 00
00

3 00
11

C 11
00

F 11
11


< Fig.1 : The meanings of the data received >


3 Hence, the meanings of the 8 bit data transmitted from the oscilloscope are given as <Fig.2>.

Hexadecimal Binary
Mark/space
signal
0 0
00 00 00 00

0 3
00 00 00 11

3 0
00 11 00 00

3 3
00 11 00 11

0 c
00 00 11 00

c 0
11 00 00 00

c c
11 00 11 00

0 f
00 00 11 11

f 0
11 11 00 00

f f
11 11 11 11

3 c
00 11 11 00

c 3
11 00 00 11

3 f
00 11 11 11

f 3
11 11 00 11

c f
11 00 11 11

f c
11 11 11 00


< Fig.2 : The meanings of the 8 bits data >

4
At this time, head, tail, grid (axes), graduations, and the line change (return) signals are all
filtered from the signal of the oscilloscope to remain only the waveform as the mark/space
form. But, if the new line signal is transmitted, the data is saved at the next row. The new line
signal is 1b 2a 57 (hexadecimal), that is, 27 42 87 (decimal), so if the signal 87 is
received then the line is changed to the next row resetting the x coordinate to zero, since the
plotting data are compounds of only 0, 3, c and f in hexadecimal notation. When the process
is completed, the file data1.dat would be created. The number of all the cells of the
oscilloscope LCD is 286720 (1024 rows * 280 columns) and 2 bits include a mark/space
information of 1 cell, so the number of hexadecimal data included in data1.dat is 71680
(512 rows * 140 columns), since 1 hexadecimal data is 4 bits. (see < Fig.3 >) Hence, the
number of a mark/space signal is 71680 / 2 = 35840.

Hexadecimal data
0
F
2 units
Binary data
0 0
0 0
1 1
1 1
8 units
Mark/space signal of 1 cell space
space
mark
mark
4 units

< Fig.3 : The relations of numbers among hexadecimal data, binary data
and a mark/space signal of 1 cell >


The significant thing to consider is that the data of the grid (axes), graduations are not
distinguishable from that of the waveform so we have to filter them from the original

5 waveform signal. And the data from the oscilloscope are transmitted by one row from left to
right, from top to bottom of the LCD.
After all the data are transmitted, then the file data1.dat is closed.

2.

Inter2.c
This file is a converting program to calculate the decimal coordinates of x and y and save
them to the file data2.dat.
When the process is performed, it will receive hexadecimal data from data1.dat by 8 bits (4
cells) and define the mark/space signal of each cell, then convert it to x, y coordinates of
decimal notation. The mark/space signals are detected by using logical calculation. First,
variables p, q, r, s are set as 3, 12, 48, 192 respectively. If the logical multiplication of p, q, r,
s by the data received from data1.dat (lets take it i) is performed, then the result will be
the separate mark/space signals of the cells, since 3 is 00000011, 12 is 00001100, 48 is
00110000 and 192 is 11000000 in binary notation. For example, if we multiply
100011<b>01(binary) by 00000011(binary) logically, we get the answer 000000<b>01(binary)
meaning that we can discriminate only the lowest 2 bits of the original signal. (see < Fig.4
>) Similarly, if we multiply 10</b>001101(binary) by 00001100(binary) logically, then the
answer is 10</b>000000(binary) and the highest 2 bits can be discriminated. The remainders
result in the same conclusions. And next, the results of (q & i), (s & i), (t & i) are shifted by 2,
4, 6 bits respectively to make them in 2 bits data. On the other hand, we have to add 1, 2, 3 to
x coordinates of marked cells for (s & i), (q & i), (p & i) respectively, because they have a
mark/space message of second 2, third 2 and the lowest 2 bits of 8 bits signals, meaning that

6 they have a mark/space message of second, third, and the last cell of 4 cells.

100011<b>01 10</b>001101
* 000000<b>11 * 11</b>000000
000000<b>01 10</b>000000
< Fig.4 : The method of detecting mark signals by logical multiplication >

By this method, we can divide the 8 bits data to 4 separate 2 bits data, so we can recognize
the mark/space signal of each cell. Now, if the answer is 000000<b>11, then the cell is marked,
and 000000<b>00 is for space. The note is that 000000<b>01 or 000000<b>10 never appears. And then,
it converts marked coordinates to decimal notation and saves them to the file data2.dat.
However, the data of the file data2.dat are the mark/space message at each cell of the
displayed waveform, so there would be many y coordinates for one x coordinate meaning that
it doesn't make a function.
Hence, the file data2.dat must be called again to the next step.

3.

Inter.m

The file inter.m is a Matlab® program for displaying. When the file inter.m is performed,
it will detect the number of data in the file data2.dat and define only one y coordinate for
one x coordinate to make a function of x, y coordinates, and also calculate the scales of time
and voltage to plot a graph in time domain. As explained before, it will also plot a graph in
frequency domain to enable the frequency analysis. At this time, the Fourier transformed

7 function of the time domain function is obtained as the frequency domain function, and the
frequency scale is also calculated.
If the signal of time domain is sampled N times by T seconds, then the sampling frequency
of the Fourer transformed signal is 1/NT Hz. So when we set 1/S as a sampling frequency,
then the signal of time domain is to be sampled by S/N seconds. It means that the sampling
times of the original signal is 0, S/N, 2S/N, , (N-1)S/N seconds and the sampling
frequencies of the Fourier transformed signal is 0, 1/S, 2/S, , (N-1)/S Hz. And it will
multiply the inputted time division by 10, for the number of grid along x axis is 10.
Also it will sub