|
Microcontroller Kits
Programmer
and Target 89s51
Simple
Mikrokontroller 89s51 Trainer

Standart
Mikrokontroller 89s51 Trainer

Super Mikrokontroller
Trainer 89s51
+
All Item Include
Programmer
Via USB
|
|
BACK NEXT
2.6.2. Generating a Stair Step Voltage from
DAC
In this lesson we are like to design, how to generate
stair step voltage from 0volt trough 5 volt, with resolution 1 volt
each step. There is something you must to do is to calculate the konstanta
K, as you have learned in previous lesson.
Step 1st
Build the circuit as shown in figure 2.6.2. As you seen on figure 2.6.2.
P0.0 trough P0.7 is connected to A8 - A1.
or example, we assumes that the Vref = 5 volt, R14 = 5 k, and Rf = 5k
K = Vref/ R14;
= 5/5k = 1 mA If, we put logic high into A1 through A8 then we have: Io = 1 mA x 0.99 = 1 mA So,Vo = Io x Rf = 1 mA x 5k = 5 volt Voltage Resolution = 5/255 = 0.02 volt
* Voltage 0 volt = 0/ 0.02 = 0 decimal
* Voltage 1 volt = 1/0.02 = 50 decimal * Voltage 2 volt = 2/0.02 = 100 decimal
* Voltage 3 volt = 3/0.02 = 150 decimal
* Voltage 4 volt = 4/0.02 = 200 decimal
* Voltage 5 volt = 5/0.02 = 255 decimal
Step 2nd
In this step, you must tipe the assembly program to make a voltage from
your DAC, we assume that you have already known the editor, we used
MIDE-51 to edit the program. ( Download File
asm : exp262.zip, Download Complete
Circuit File : DAC0808.pdf
)
org 0h start: mov A,#0 mov P0,A call delay ; mov A,#50 mov P0,A call delay ; mov A,#100 mov P0,A call delay ; mov A,#150 mov P0,A call delay ; mov A,#200 mov P0,A call delay ; mov A,#255 mov P0,A call delay ; sjmp start ;============================================= ;subroutine delay created to rise delay time ;============================================= delay: mov R1,#255 del1: mov R2,#255 del2: djnz R2,del2 djnz R1,del1 ret end
Step 3rd
Safe your assembly program above, and name it with dac2.asm (for example)
Compile the program that you have been save by using MIDE-51, see the
software instruction.
Step 4th
Download your hex file into the microcontroller by using
Microcontroller ATMEL ISP software, see the instruction.After download
this hex file you'll see the action of DAC ( of course if your cable
connection and your program are corrected )
Comments,
questions and discussion about this topic
BACK NEXT
|
|
|
|