Sei sulla pagina 1di 9

Objective The objective of this lab is to show how the interfacing can be accomplished for a digital to analog conversion.

This specific exercise in signal conversion used the DAC0808 integrated circuit. Setup We begin this lab by making sure that the 68HC11 is running in single chip mode and building the circuit diagrammed in Setup Example 1. In this example we are using the DAC0808 connected to PORTB of the 68HC11. By using the DAC0808 we can take a digital input and convert it to an analog output. This is accomplished by using 8 bits which provides a resolution of 256 steps. Setup Example 1

Lab 61 In this lab we were instructed to begin by computing the output voltage provided by the following digital input values. We needed to determine these values to test our circuit and also to show the relationship between the digital input and the output current. The mathematical formulas defining this relationship are shown in Formula Example 1.

Formula Example 1

By using these formulas we can determine the expected output voltages as listed below: A. 0000 0000 0.0 volts B. 0000 0001 -0.195 volts C. 0000 1111 -0.293 volts D. 1111 0000 -4.6875 volts E. 1111 1110 -4.9609 volts F. 1111 1111 -4.9804 volts We can see from these calculations that the voltage can be increased or decreased by controlling what bit pattern is used as the input. In this scenario we can operate with an analog output from 0 volts to -4.98 volts. Lab62 The second part of this lab was to develop a program that would send a number to PORTB which is being used as the digital input for our circuit. This program is listed as Code Example 1. The flowchart for this program is listed under Flowchart Example 1.

Code Example 1 * * Lab 61 * * In this lab, we use the DAC0808 DAC to generate a voltage. * PORTB VOLT Start Wait EQU $1004 EQU %11111111 ORG $0100 LDAA #VOLT STAA PORTB LDX #2000 NOP NOP DEX BNE Wait BRA Start

Flowchart Example 1
Start

Load bit value to Accumulator A

Store Accumulator A to PORTB

Pause for 10 milliseconds

We were then asked to measure the voltage of the output which is output on Pin4 of the DAC0808. We used a multimeter connected to Pin4 and ground to measure the voltages output. We began with an input of 0000 0000 and proceeded to adjust our program to use all of the inputs listed in Lab61. The recorded results are listed below. INPUT CALCULATED MEASURED A. 0000 0000 0.0 volts 0.00 volts B. 0000 0001 -0.195 volts -0.02 volts C. 0000 1111 -0.293 volts -0.29 volts D. 1111 0000 -4.6875 volts -4.69 volts E. 1111 1110 -4.9609 volts -4.96 volts F. 1111 1111 -4.9804 volts -4.98 volts From the calculated and measured values we can assume that our circuit is properly wired and also that our program works as expected. Lab 63 The next portion of this lab required that we create a program that will generate an output wave as shown in Wave Example 1. For this scenario we must connect our output pin and ground to an oscilloscope to properly record the wave. Wave Example 1

We must also consider that this wave will occur over time so we need to calculate the proper increment period. Our period is determined by dividing 1 by the frequency. In this case 1/3.90625 gives us 0.256 or 256 milliseconds. We also have 256 steps of control using the DAC0808 so we must decrement our input by 1 every millisecond. The wave would move from -5.0 volts to 0.0 volts in 256 steps that occur every millisecond. The program to accomplish this is show in Code Example 2 and the flowchart for this program is shown in Flowchart Example 2.

Code Example 2 * * Lab 62 * * In this lab, we use the DAC0808 DAC to generate a voltage. * We will be generating a saw tooth wave. * PORTB EQU $1004 ORG $0100 LDAA #%11111111 STAA PORTB LDX #200 NOP NOP DEX BNE Wait DECA BRA Start

Start Wait

Flowchart Example 2
Start

Load bit value 11111111to Accumulator A

Store Accumulator A to PORTB

Pause for 1 milliseconds

Decrement Accumulator A by 1

After making some adjustments to the oscilloscope to get the proper readings we were able to verify that our waveform did correspond to the wave listed in Wave Example 1. Lab 64 This exercise is extremely similar to the previous however we are using a different waveform. In this exercise we must move from -5.0 volts to 0.0 volts and then back to -5.0 volts in a continuous pattern using a frequency of 2 Hz as shown in Wave Example 2. Wave Example 2

Using this wave we can again calculate our period to be 500 milliseconds for the wave to start at -5.0 volts and return to -5.0 volts. This indicates that each decrement and increment (512 total: 256 decrements and 256 increments) must take approximately 0.98 milliseconds. The program to accomplish this task is listed as Code Example 3 and the associated flowchart is listed as Flowchart Example 3.

Code Example 3 * * Lab 63 * * In this lab, we use the DAC0808 DAC to generate a voltage. * We will be generating a triangular wave. * PORTB EQU $1004 ORG $0100 LDAA #%11111111 STAA PORTB LDX #196 NOP NOP DEX BNE Wait DECA BNE Up STAA PORTB LDX #196 NOP NOP DEX BNE Wait2 INCA CMPA %11111111 BNE Down BRA Up

Up Wait

Down Wait2

Flowchart Example 3
Start

Load bit value 11111111to Accumulator A

Store Accumulator A to PORTB

Pause for 0.98 milliseconds

Decrement Accumulator A by 1

Accumulator A is 0

No

Yes Store Accumulator A to PORTB

Pause for 0.98 milliseconds

Increment Accumulator A

Yes

Accumulator A is 255

No

Conclusion
The integrated circuit DAC0808 gave us a good example of how a digital input can be converted to an analog output. Through the examples provided and the use of the oscilloscope and multimeter we were able to convert a digital signal and then verify that is was being output as an analog output of an expected value. Using this circuit made the conversion quite simple and the examples provided some conceptual ideas of how such conversions could be accomplished as well as how the basic interfacing might take place.

Potrebbero piacerti anche