[Laser] serial port PDM and PWM

TWOSIG at aol.com TWOSIG at aol.com
Thu Dec 7 00:44:36 EST 2006


As a follow on to the idea of optimizing sound card ( radio communication )  
modes for optical communication, I stated that the output should be two state  
because much of the equipment to emit light tends to be highly non-linear.   
This is at odds with the sound card which is trying to generate accurate 
analog  complex sine wave output.
 
An alternative is to use the computer serial port which is specifically  
designed to output "ones" and "zeros".  Recently, computers have gotten  away from 
providing the classic serial ports that are well suited for what I am  about 
to describe.  This is particularly true of new laptop computers that  might be 
better tools for field work with optical communication links.   However, even 
USB and IEEE 1394 (such as i.Link from Sony and Firewire  from Apple ), which 
are optimized for bursts of high speed data to and from  multiple devices, 
may provide ways to use this idea.
 
The computer serial port provides a means to transmit and receive data from  
other devices.  For this application, we need only look at the transmission  
system.  Data from the computer memory is sent to the port.  The  actual 
mechanism is not important, but the essence is that the contents of  memory, such as 
an ASCII character, is sent to the port, which then sends it out  over wires 
one bit at a time.  To do that, the port needs to  add leading zero bit(s) ( 
START ) and trailing one bit(s) ( STOP  ).  The port can be configured, and for 
this example I am going to use  eight (8) data bits, no parity, single start 
bit, single stop bit.  I am  also going to assume that the data is transmitted 
most significant bit to least  significant bit.  ( Those of you who know 
wheither that is Big Endian or  Little Endian can explain the difference. )  I am 
also going to use 115,000  bits per second for this example, and assume that 
the computer and software  being used can stuff enough data at the port that it 
will run continuously for  the time that we are interested.  
 
The electrical interface for this should be isolated and leave the optical  
device emitting when the port is in its idle state.  Data transmission will  
cause the output to blink off for one bit time, about 8.7 microsecond.  The  
data bits follow, as does one stop bit.  If the data is being sent  continuously, 
there should be no lag between the end of one byte's stop bit and  the next 
byte's start bit.  Each eight bits of data requires ten bit times  to transmit. 
 The number of bytes being sent is therefore 11,500.  For  the PWM and PDM 
systems this is the basic sample rate.  Since there are  eight data bits that 
are under the control of the software, there can be only  nine states being sent 
in any one sample.  ( There are 256 ways that the  eight bits can be 
arranged, but for this purpose we only care how many are  "ones".  The hexidecimal 
values X'33", X'55", X'66", X'99', X'AA',  and X'CC' are all equivalent having 
four bits in the "one" state.   From the standpoint of the average value of an 
individual sample the minimum  value is 1 of 10, or 0.1 density.  The maximum 
is 9 of 10, or 0.9  density.  Zero out of ten cannot be sent because the must 
always be a stop  bit sent by the port.  Similarly ten out of ten cannot 
because there must  always be a start bit. ) 
 
That gives us a sample rate of 11,500 per second and a granularity  of nine 
states.  It might be possible to send acceptable voice data  under those 
conditions.  If you were to send 16 consecutive X'FF' followed  by 16 of X'00', you 
get a a 359.375 Hz square wave.  If you reverse the  order, you have all that 
is needed to create BPSK.  A slightly more eligant  way to do the same thing 
is to approximate the shape of a sine wave, rising  for 16 samples, then 
falling for 16. ( Reverse for the other phase. )  

QPSK needs four phase states. For a square wave implimentation you  need to 
change the phase by a value of 0, 90, 180, or 270 degrees.  To  change by 0, 
continue the current sequence.  To change by 180, reverse the  order of the 16 
X'FF' and 16 X'00'.  To change by 90, send X'AA' for 8  samples and continue 
the current sequence.  To change by 270, send X'AA'  for 8 samples and reverse 
the X'FF' and X'00'.  ( Or you could send 0, 8,  16, or 24 samples of X'AA' for 
the 0, 90, 180, or 270 degree phase shifts.
 
For a pseudo sine wave the sequence runs so: 
Start at minimum, rise for 16 samples reaching maximum, then fall for 16  
samples returning to minimum.  
Start at mid-value, rise for 8 samples reaching maximum, then fall for  16 
samples reaching minimum, the rise for 8 samples returning to  mid-value.  
Start at maximum, fall for 16 samples reaching minimum, then rise for 16  
samples returning to maximum.  
Start at mid-value, fall for 8 samples reaching minimum,  then rise for 16 
samples reaching maximum, the fall for 8  samples returning to mid-value.  
 
 
In a similar manor you can create frequency and phase relationships that  you 
may need for FSK, IFSK, multitone..... Whatever.
 
 
 
The nine state granularity can be extended by grouping samples. Two  
consecutive samples allow you to have 17 states, but only 5750 samples per  second.  
Three sample groups have 25 states at 3833.333.  Four, 33 at  2875.  ( This is 
where higher bit rates on the port help.  Perhaps a  simple interface board 
for a USB or 1394 to UART would help. )
 
 
 
If the intend is to produce PWM, the 8 datat bits to be sent to provide the  
output states are:
 
 
State 1        X'00'   ASCII  NUL
State 2        X'01'    ASCII SOH
 
State 3        X'03'    ASCII ETX
State 4        X'07'    ASCII BEL
 
State 5        X'0F'    ASCII SI
State 6        X'1F'    ASCII US
 
State 7        X'3F'    ASCII ?
State 8        X'7F'    ASCII DEL
 
State 9        X'FF'   (  I think the ASCII is a y with double dot over it. )
 




 
 
 
 
The PDM data for each state is open to some interpretation.  I suggest  the 
following:
 
 
State 1        X'00'   ASCII  NUL
State 2        X'10'    ASCII DLE
 
State 3        X'24'    ASCII $
State 4        X'92'    ASCII '
 
State 5        X'AA'    ASCII ( superscript a with underscore )
State 6        X'6D'    ASCII m
 
State 7        X'DB'    ASCII U with a carret
State 8        X'F7'    ASCII ( divide sign )
 
State 9        X'FF'   (  I think the ASCII is a y with double dot over it. )
 
 
 
Getting the hooks into existing software to use these data samples via the  
serial port may be more difficult than adapting the sound card output, but I  
hope that I have suggested something that can be used for beacons or newly  
developed software that is appropriate for optical emitters.
 
 
James
N5GUI
 







More information about the Laser mailing list