Loading ...
Sorry, an error occurred while loading the content.

Serial Port A/D-converter

Expand Messages
  • Nicolae Sfetcu
    Serial Port A/D-converter By Tomi Engdahl 1996 This circuit is a simple 8-bit analogue to digital converter circuit which is connects to PC serial port. The
    Message 1 of 1 , Jul 12, 2001
    • 0 Attachment

      Serial Port A/D-converter

      By Tomi Engdahl 1996

      This circuit is a simple 8-bit analogue to digital converter circuit which is connects to PC serial port. The circuit is based on TLC548 A/D-converter chip (might be hard to get nowadays, Texas Instruments makes this IC), which is an A/D-converter with serial output. The output of the TLC548 is not directly suitable for standard serial data reception, so this circuit uses serial port handshaking lines in a nonstandard way which enables the communication between computer and converter chip to be implemented with as few components as possible. The circuit takes all the power it needs from PC serial port.

      Technical data of the circuit

      Maximum sample rate: 40 000 samples/second (maximum rate of TLC548 chip)
      Input voltage range: 0-5 V
      Accuracy of A/D converter chip: 8 databits (+-0.5 LSB)
      Computer interface: PC serial port
      Interface protocol: Proprietary syncronous serial interface (uses PC serial port as general purpose I/O port)

      The TLC548 IC datasheet is available at http://www-s.ti.com/sc/psheets/slas067/slas067.pdf.

      Circuit diagram

      The picture below is tha circuit diagram of the circuit. The pin numbers of the connector are pin numbers of 25-pin serial port connector. All diodes are IN4148 or similar. All resistors connected to IC are 30 kOhm and their function is to protect the IC inputs with the diodes against overvoltage. The 1 kOhm resistor, one diode, 5.1V zener-diode, 10uF and 100nF capacitors make the power supply which takes circuit power from serial port Data Terminal Ready -pin.

      Circuit diagram

      Circuit diagram of the serial port A/D converter. This picture is available separately in GIF format.

      Component list

      • 3 pices of 30 kohm resistor
      • 7 pieces of 1N4148 diode
      • 1 kohm resistor
      • 5.1 V zener diode
      • 10 uF 15V electrolytic capacitor
      • 100 nF capacitor
      • TLC548 A/D converter IC (may be hard to get)
      • 25 pin female D connector

      Control signals

      The following signal diagram tells that signals are needed for controlling the TLC548 A/D conversion chip. The chip needs chip selected (CS) and i/o clock signal (CLK) to operate. The chip gives the conversion results from data output pins (Dout). Those signals are simple and easy to understand and can be easily generated using simple software routine.

      Signal diagram

      Signal diagram of TLC548 chip. This picture is available separately in GIF format.

      This type of signaling is quite common in many A/D converters with serial outputs. There are differences in different type of A/D converters, but you can easily use the ideas used in this circuit for interfacing other types of A/D converters to your PC.

      Software

      Here is a simple program for testing and operating A/D converter circuit. The program is written using Turbo Pascal version 4.0 and can be compiled with never versions also. This program needs to know the address of your PC's COM-port and you have to set it to the source code before running it. If you have very fast computer, you might have to add some delay after if I/O access.


      Program serial_adc;
      
      Uses Crt;
      
      Const
          combase=$2f8;    { I/O address of the COM port you are using }
          MCR=combase+4;
          LCR=combase+3;
          MSR=combase+6;
      
      Procedure Initialize_converter;
      Begin
         Port[MCR]:=3;    { make DTR line to supply power and set CS input of chip to 1 }
         Port[LCR]:=0;    { set clock line of the chip to 0 }
      End;
      
      Function Read_value:byte;
      Var
         value:byte;
         count:byte;
      Begin
         value:=0;
         Port[MCR]:=1;                     { set CS down }
         For count:=0 to 7 Do Begin        { do the bit value eading 7 times }
            value:=value SHL 1;            { value=2*value }
            Port[LCR]:=64;                 { clock line up }
            If (port[MSR] and $10)=$10 Then Inc(value);   { read the input data and update value }
            Port[LCR]:=0;                  { clock line down }
         End;
         Port[MCR]:=3;                     { set CS up again }
         Read_value:=value;                { return the value }
      End;
      
      Begin
         Initialize_converter;            { call initialization routine }
         Repeat
            Writeln(Read_value);          { call reading routine and print the value }
         Until KeyPressed;                { repeat until any key is pressed }
      End.
      

      Frequently asked questions and answers

      How the out of the ADC is converted to -10V and +10V for RS232 ?

      I don't convert them to those voltges. Normal PC serial port will not need the full voltage range to operate. I just put the TTL level output from the ADC chip and this will worj for PC RS-232 ports when wires are short.

      Don't you need start and stop bits like in normal RS-232 data?

      I don't use standard RS-232 protocols. The circuit does not use normal data transmission or reception of RS-232 serial data. All the data transfer is carried though CTS input on bit by bit basis controlled by the output signals from TD and RTS lines.

      Other information sources

      Ian Harries has designed quite similar circuit for parallel port using TLC549 chip, which is quite similar to TLC548. The circuit is available at http://www.doc.ic.ac.uk/~ih/doc/adc_dac/tlc549/ and you can find some documentation of TLC549 chip there also.

    Your message has been successfully submitted and would be delivered to recipients shortly.