OBJECTIVE:
- Students understand the microcontroller interface circuit with DAC0808
- Students understand the reference current settings on the DAC
- Students understand the calculation of output voltage
- 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:
- Place a jumper on the EN_DAC connector to enable the DAC circuit.
- Set the IREF current by connecting the connector using an ammeter, set the potentiometer R14 to provide a certain current reference of around 2mA.
- Install a jumper on the IREF connector
- Connect the Microcontroller Trainer module to the +5V power supply.
- Connect the Microcontroller Trainer module to the programmer circuit
- Open the M-IDE Studio for MCS-51 program, as a program editor and compiler.
- 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
- Save the program you typed and name it: prog61a.asm
- In the MIDE program, select Build /F9 or to compile the program from *.asm to *.hex.
- Program the microcontroller using the ISP Software Program (See Instructions for Use)
- Make observations using a Voltmeter.
- 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:
- Place a jumper on the EN_DAC connector to enable the DAC circuit.
- Set the IREF current by connecting the connector using an ammeter, set the potentiometer R14 to provide a certain current reference of around 2mA.
- Install a jumper on the IREF connector
- Connect the Microcontroller Trainer module to the +5V power supply.
- Connect the Microcontroller Trainer module to the programmer circuit
- Open the M-IDE Studio for MCS-51 program, as a program editor and compiler.
- 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
- Save the program you typed and name it: prog62a.asm
- In the MIDE program, select Build /F9 or to compile the program from *.asm to *.hex.
- Program the microcontroller using the ISP Software Program (See Instructions for Use)
- Make observations using a Voltmeter.