Design IdeasMarch 3, 1997 |
Bernard Willaert, Barco Display Systems, Kortrijk, Belgium
The circuit in Figure 1 allows you to control low-cost, three-wire D/A converters through a PC's serial port. A 74HC14 extracts the three signals (data, clock, and load) from the signal on one wire. The method relies on the data-pulse width: a short pulse is a logic 1; a long pulse is a logic 0. The serial-port settings are COM1/9600 baud/no parity/8 data bits. A logic 1 transmits as 255, which leads to a short pulse (start bit only); a logic 0 transmits as 0, which results in a pulse that's nine times longer. Figure 2 is the timing diagram for the process.
Inverter IC1A extracts the data signal for the DAC by inverting the incoming serial-data stream. At the input of IC1A, the internal protection diodes clamp the positive and negative voltage swings. IC1B gives a start pulse at the positive-going edge of every incoming start bit. IC1C produces a delay of approximately four bit periods (43104 msec at 9600 baud). The end of this delay pulse determines the clock-pulse position at IC1D. At this point, the incoming data stream clocks as logic 1 or 0 into the DAC's shift register.
IC1E and IC1F have the same function as IC1B and IC1C, but with a longer time constant. IC1E is a retriggerable monostable multivibrator that runs out shortly after the transmission of the last data byte. At this time, IC1F produces a short load pulse to clock the DAC's data into the output latches. The DAC's output value then appears at the addressed analog output.
You can cascade multiple DACs of different types (8 or 12 bits, for example) by connecting the Data Out of one DAC to the Data In of the next. Together, they form one long shift register. The small DOS program in Listing 1, written in Borland C version 3.0, illustrates the process. For 1238-bit DACs (the MB88346B, for example), you first shift the address (1 to 12) into the DAC; then, you shift the 8-bit data. (DI #1983)
| Figure 1 |
| If you must add an extra remote DAC to an embedded system, and only one output port is available, this circuit can help. |
| Figure 2 |
| This timing diagram shows what happens in Figure 1's serial-port DAC controller. |
| Listing 1Three-wire DAC control |
| If you must add an
extra remote DAC to an embedded system, and only one output port is
available, this circuit can help.
#include <stdio.h> #include <bios.h> void main(void) { // Array for MB88346B - 4 Address bits/8 Data bits: // dacbits = Address[LSB..MSB]Data[MSB..LSB] unsigned int cnt,address,data; // Initialize COM1 port 9600 bd bioscom(0,0xE0|0x03,0); // Get address and data printf("Address:");scanf("%u",&address); printf("Data:");scanf("%u",&data); // Send out address for(cnt=0;cnt<4;cnt++) { if(address & 0x01) bioscom(1,255,0); else bioscom(1,0,0); address>>=1; } // Send out data for(cnt=0;cnt<8;cnt++) { if(data & 0x80) bioscom(1,255,0); else bioscom(1,0,0); data<<=1; } } |
| EDN Access | Feedback | Subscribe to EDN | Table of Contents |