Digital to Analog Converter (DAC)

OBJECTIVE:

  1. Students understand the microcontroller interface circuit with DAC0808
  2. Students understand the reference current settings on the DAC
  3. Students understand the calculation of output voltage 
  4. Students understand DAC assembly programming


Figure 6.1. DAC0808 circuit

Basic Theory

DAC0808 is one example of a D/A converter. This IC is inexpensive and widely used in several applications, this D/A implements an 8-bit R-2R ladder method equipped with a reference current source and eight switching transistors to direct the binary current. An external voltage and resistance are used to set the reference current at a common value of 2 mA. DAC0808 has a 150ns settling time and relative accuracy.

The pin configuration is shown in Figure 6.2. with the following explanation. Pin 1 is not used (NC stands for no connection). Pin 2 is the connection to ground. Pin 3 ( ) must be installed at -12V. Pin 4 is the return channel from ground, which acts as an inverting output. Pins 5 to 12 are 8 bits of data input. Pin 13 ( ) must be installed on the +5V power supply. Pin 14 is connected to the positive power supply through resistor R14, and pin 15 is connected to ground through resistor R15. Finally, a capacitor between pin 16 and pin 13 functions to provide frequency compensation for this IC.


Figure 6.2. Configuration pins

Experiment 6.1. Outputting a Specific Voltage to a DAC

In this experiment, a certain voltage will be output through the DAC. To do this experiment, do the following steps:

  1. Place a jumper on the EN_DAC connector to enable the DAC circuit.
  2. Set the IREF current by connecting the connector using an ammeter, set the potentiometer R14 to provide a certain current reference of around 2mA.
  3. Install a jumper on the IREF connector
  4. Connect the Microcontroller Trainer module to the +5V power supply.
  5. Connect the Microcontroller Trainer module to the programmer circuit 
  6. Open the M-IDE Studio for MCS-51 program, as a program editor and compiler.
  7. Type the following program: ( download file prog61a.asm )
org 0h
           mov A,#50 ; Data desimal yang akan dikeluarkan
start: mov P2,A ; copy data A ke P2
           sjmp start
           end
  1. Save the program you typed and name it: prog61a.asm
  2. In the MIDE program, select Build /F9 or to compile the program from *.asm to *.hex.
  3. Program the microcontroller using the ISP Software Program (See Instructions for Use)
  4. Make observations using a Voltmeter.
  5. Make modifications to the program to output other voltages, according to the table:
| OUTPUT DAC (Volt) | DATA DESIMAL (DES) |
|-------------------|--------------------|
| 1                 | ?                  |
| 1,5               | ?                  |
| 2                 | ?                  |
| 2,5               | ?                  |
| 3                 | ?                  |
| 3,5               | ?                  |
| 4                 | ?                  |
| 5                 | ?                  |
| 6                 | ?                  |
| 7                 | ?                  |
| 8                 | ?                  |
| 9                 | ?                  |
| 10                | ?                  |

Experiment 6.2. Outputting a 0 to 10V Ladder Voltage

In this experiment, a certain voltage will be output through the DAC. To do this experiment, do the following steps:

  1. Place a jumper on the EN_DAC connector to enable the DAC circuit.
  2. Set the IREF current by connecting the connector using an ammeter, set the potentiometer R14 to provide a certain current reference of around 2mA.
  3. Install a jumper on the IREF connector
  4. Connect the Microcontroller Trainer module to the +5V power supply.
  5. Connect the Microcontroller Trainer module to the programmer circuit 
  6. Open the M-IDE Studio for MCS-51 program, as a program editor and compiler.
  7. Type the following program: ( download file prog62a.asm )
    org 0h
               mov A,#0
    start: mov P2,A
               inc A
               call delay
               cjne A,#255,start
               mov A,#0
               sjmp start
               ;
    delay: mov R1,#255
    del1: mov R2,#255
    del2: djnz R2,del2
               djnz R1,del1
               ret
               end
  8. Save the program you typed and name it: prog62a.asm
  9. In the MIDE program, select Build /F9 or to compile the program from *.asm to *.hex.
  10. Program the microcontroller using the ISP Software Program (See Instructions for Use)
  11. Make observations using a Voltmeter.

Post a Comment

Previous Next

نموذج الاتصال