Testing of an Analog-to-Digital Converter using VHDL


One of the problems we encountered while trying to test our ADC design was that we could not determine if the wrong outputs generated from the ADC were coming from the hardware circuit or the VHDL code written.

To ensure success in the entire design, we needed to be able to guarantee either the correctness of the hardware design or the accuracy of the VHDL program that ran the circuit. This student application note will not focus on the hardware implementation of an analog to digital converter (ADC) but rather, on the testing of an ADC using just the Altera board and VHDL code to simulate the entire circuit (ADC and Sample&Hold chips are not used at all). The correct simulation of the code will ensure the correctness of the VHDL code and hence, that eliminates the fact that the wrong outputs that may be generated are coming from inaccuracy in VHDL coding.


Test Procedure:

1) Determine the number of output bits required. Also, the availability of the chips from Morris is an essential not to mention, a convenience too.

2) Design the hardware using the chips while paying careful attention to the specifications sheets.

3) Determine all the input and output of the chips and whether or not to ground/power each individual pin signal.

4) Write a VHDL code for the ADC to control the various input and output signals coming from and out of the ADC and the sample-and-hold chip. For now, we can ignore the two stages of the amplifier. We are not concern about the operational amplifiers at this present moment.

Basically, a state machine is implemented to enable the control of various signals. Here, we have used the outputs and inputs of the ADC0809 and the SMP-11 chips.The code below, test_ADC.vhd can be used as an example:

------------------------------------------------------------------

------------------------------------------------------------------------

A clock divider is incorporated into this program in order to enable our naked eyes to see the blinking lights on the Altera board when the analog signal changes. The VHDL program for the clock divider, clock_divider.vhd is shown below:

-----------------------------------------------------------

------------------------------------------------------------------------

 

4) Save the codes in two different filenames using the entity name as the filename. Compile the VHDL codes in MaxPlus2 and simulate waveforms to ensure correctness of code. Note that attention has to be drawn to the fact that the push buttons on the Altera board is active low. Moreover, the behaviour of every signal coming from/into the chip has to be analysed properly from the specification sheets.

5) Perform pin assignments on the Altera board.

Signal Name Pin Number Hole Number
bits(0) 55 23
bits(1) 56 24
bits(2) 61 25
bits(3) 62 26
bits(4) 63 27
bits(5) 64 28
bits(6) 65 29
bits(7) 66 30
data_out(0) 72 35
data_out(1) 73 36
data_out(2) 74 37
data_out(3) 75 38
data_out(4) 76 39
data_out(5) 78 40
data_out(6) 79 41
data_out(7) 80 42
clock 91 -
slow_clock 101 56
nreset 28 (push button) -
start_of_conv 82 44
end_of_conv 81 43
sample 83 45

 

6) Connect the data_out(0-6) bits from the Altera board to the LEDs. The bits(0-6) will be connected to the switches on the board. Use the board we used for EE280 if difficulty is encountered with the switches on the Altera board. The inputs are entered manually here. The SOC, EOC, clock can be connected to a bread board and probed with the pointer (of an oscilloscope) to check for the outputs. When the EOC signal is set to high, the state should transfer from one state machine to the other continuously. When EOC is set to low, the state machine will remain at state in_conv. Reset will be high but when the push button is pressed, the current state will revert back to the initial state of sample_conv.

7) The simulation waveforms are as follows:

Waveform 1 shows the simulation under normal conditions and when conversion is continuossly performed without any reset or EOC signal interference.

Waveform 2 shows the simulation waveform when the EOC signal is set to zero in the middle of the conversion. Note that state machine remains at state in_conv as long as the EOC signal is set to zero. Once again, remember that the EOC signal is active low.

Waveform 3 shows the simulation waveform the signal EOC is set to zero for the entire duration. Once again, the state machine remains at state in_conv.

Waveform 4 shows the simulation waveform when reset is set to zero. Note that reset is active low. The state machine returns to the initial state, start_conv after the reset push button is pressed down.

 Note : Hold the 'shift' key and right click the mouse to view the waveforms.

References

- Microelectronic Circuits - Sedra & Smith

- Student Application Notes (semester-winter1999)- Audio Adc

- National Semiconductor, "Data Acquisition Databook", National Semiconductor

- http://www.ee.ualberta.ca/~elliott/ee552/reports.html

- ADC Datasheet


Last updated: November 9, 1999