EE314 Microprocessor Systems

Laboratory Project 07

Parallel Printer port use and Digital-to-Analog Conversion


Introduction
In this 2-week laboratory assignment you will be constructing a circuit that will interface to the PC through the printer port. The circuit will implement a simple two-channel D/A converter. The first part of the problem is to construct and test the D/A converter. The second part will be to use this converter to display various patterns on an oscilloscope.


Goals for this lab are:

  1. Understand how to use the printer port hardware interface.
  2. Understand how an R-2R ladder works for D/A conversion.
  3. Write a program which uses both C and Assembly language to interface to hardware.


NOTE: You will be required to furnish your own protoboard. One set of components will be provided for each pair of students.



Pre-Lab

(Due at the beginning of the first lab period.)


1. Review the detailed schematic for a simple two-channel D/A converter (attached). Note how the converter is controlled by the standard printer port. Also review the given printer port organization. What values need to be output to the printer port registers to load data into each of the 74LS273 registers?


2. Write a program in C with inline assembly statements to test the parallel port and D/A converters. The following output functions demonstrate the use of inline assembly for sending data to an arbitrary I/O port.


#define ubyte unsigned char
#define byte char
#define uword unsigned int
#define word int

void OutPortByte( uword IOAddress, ubyte Value )
{
_DX = IOAddress;
_AL = Value;
asm out dx,al;
}

void OutPortWord( uword IOAddress, uword Value )
{
_DX = IOAddress;
_AX = Value;
asm out dx,ax;
}

Of specific interest is to determine how linear each converter channel is. A simple way to test DAC linearity is to repeatedly scan through all possible values (from 0 to 255) and observe how "straight" the waveform is on the oscilloscope.

 

 

Laboratory Procedure

 

  1. Construct your hardware. Check it carefully before connecting it to the printer port. A
    misconnection WILL burn out a component.
  1. Test both channels of the D/A converter. Plot the linearity of the converters.
  1. Derive a way to drive the binary D/A converter with 2s complement numbers. This should be done totally in software.
  1. Write a program to drive the two channels simultaneously. The program is to "draw" Lissajous figures on the screen of the oscilloscope. You should be able to select any of the following figures: 45 deg line, circle, vertical figure 8, sidewise figure 8.
  2. Extend your program from the previous problem to allow the Lissajous figures to "rotate" at varying rates in space. This is done by varying the phase angle of one of the sine signals.

Demonstrate your programs by the end of the second lab period. The report is due at the start of the lab period following the second week. Include all programs in the report and observe the required format.

Extra Credit

 

Develop a program that will draw an arbitrary figure on the oscilloscope. Demonstrate it using a figure of your choice, for example, your initials or a favorite cartoon character.

 

 

Appendix Printer Port Configuration and D/A Converter Schematic




Data Port (378 H)

7

6

5

4

3

2

1

0

data 7

data 6

data 5

data 4

data 3

data 2

data 1

data 0




Control Port (37A H)

7

6

5

4

3

2

1

0

init

autfd

strb