Sei sulla pagina 1di 7

GROUP A

A1: INTERFACING 8051 BASED EXEPERIMENTS:


Sr. NAME DATE PAGE SIGN
No. NO.
INTERFACING 8051 BASED EXPERIMENTS
01. Interfacing 8 bit DAC with 8051
02. Interfacing stepper motor with 8051

INTERFACING 8 BIT DAC TO 8051

INTERFACING DAC WITH 8051 MICROCONTROLLER


AIM : To interface a 8 bit DAC with the 8051 microcontroller through port p1 and generate
the assembly language program.
APPARATUS : microcontroller kit,8 bit DAC 0808, 12 volt dual power supply, bread board
,CRO, IC 741 etc.
THEORY : The DAC converts digital pulses to analog signals. There are two methods of
converting digital signals to analog signals. Binary weighted and R12R and ladder DAC 0808
includes DAC R12R method. Since higher degree of precision can be achieved, the most
important criteria for using a DAC is its resolution which is function of number of binary
inputs.
The common no. of data bits of DAC are 8,10 and 12. The no.. of data bits determine the
resolution of DAC. Since the no. of analog output level is equal to 2^n. where n is the no. of
data bits input. Therefore the 8 bit DAC provides 256 discrete voltage.
The DAC 0808, the digital inputs converts into equivalent current and by connecting the
register to the input pin. We convert the output current into voltage. The total output current
Iout pin is function of binary no. at input of DAC 0808 and reference current as Iref as
follows :
Iout = Iref (D7/2 + D6/4 + . . . + D0/256)
.: Iref = Vin/Rin.
Where D0 is LSB and D1 is MSB for inputs. The value of Iref current is generally upto 2Ma.
To convert the current Iout into voltage we can connect the pinto a register and monitor the
output on CRO . However it can causes problem because the input resistance of the load
connected to it will also affect output voltage. For this reason, the Iref output current is
isolated by connecting it the op-amp IC 741 with feedback resistor. Rf thus by changing
binary input the output voltage will change and hence the op-amp connected as current to
voltage convertor will give output voltage.
V out = I out x R out (Rf)
.: Rf/Rin = Vin (D7/2 + D6/2 + . . . + D0/256)
Thus for Vin = 10V ; Rin = 5K ohm for output voltage.
Vout = 5.1 x ( D7/2 + D6/4 + . . . + D0/256) X 2.
To generate the waveform the microcontroller kit is interfaced with DAC. The DAC can be
the built up DAC card or can be a constructed DAC circuit on bread board. When 8051
interfaced with DAC 0808, the port A pin of 8051 microcontroller are connected to input pin
of DAC with MSB connected to MSB and LSB connected to LSB. Same goes with other
pins. Thus the analog output will change according to the change in port inputs by providing
suitable input through port 1. We can obtain different waveform using proper delay.
Since microcontroller is a programmable control device and it takes time to execute the
instruction. It can generate delay between two events through programming. The delay can be
introduced by either using NOP instruction or 8 bit as well as 16 bit memory location used as
counter. This feature is very useful in waveform generation.
TRIANGULAR WAVE
ADDRESS OP-CODE LABEL MNEMONICS COMMENTS
6000 74 00 START mov A,00H ;clear the content of
accumulator
6002 F5 90 LOOP mov P1, ;ove the content of
accumulator to port1
6004 04 inc A ; increment accumulator
6005 B4 33 F9 CJNE A, #33, ; compare FF with
LOOP accumulator and jump if
not equal
6008 14 AGAIN Dec A ; decrement
accumulator
6009 F5 90 mov P1, A ; move the content of
accumulator to port1
600B B4 00 F9 CJNE A, #00H, ; compare 00H with
AGAIN accumulator and jump if
not equal
600E 80 EF SJMP START ; jump to start

SAW- TOOTH WAVE


ADDRESS OP-CODE LABEL MNEMONIC COMMENT
S
7000 74 00 START mov A, ; clear the content of
#00H accumulator
7002 F5 90 LOOP mov P1, A ; move the content of
accumulator to port1
7004 04 Inc A ; increment accumulator
7005 B4 33 FA CJNE A, #33, ; compare FF with
LOOP accumulator and jump if
not equal
7008 80 F6 SJMP START ; Jump to START

SQUARE WAVE
ADDRESS OP-CODE LABEL MNEMONICS COMMENT
6000 74 FF START mov A, #FFH ; move FFH to A
6002 F5 90 mov P1, A ; send content of A to
P1
6004 79 0F mov R1, #0FH ; Move 0FH to R1
6006 7A 0F mov R2, #0FH ; move 0FH to R2
6008 12 01 14 LCALL DELAY ; call delay subroutine
600B 12 01 14 LCALL DELAY ; call delay subroutine
600E 74 00 mov A, #00H ; move 00H to A
6010 F5 90 mov P1, A ; send content of A t P1
6012 79 1F mov R1, #1FH ; Move 1FH to R1
6014 7A 1F mov R2, #1FH ; Move 1FH to R2
6016 12 01 14 LCALL DELAY ; Call delay subroutine
6019 12 01 14 LCALL DELAY ; Call delay subroutine
601C 80 E1 SJMP START ; Jump to label START
INTERFACING STEPPER MOTOR
Stepper motor rotates in fix step of a certain number degree. Step size can be
very form 0.9 to 90 degree. Stepper motor are useful in controlled application
because the controller can determine the exact position of stepper motor shaft
without any sensor for measuring shaft position further stepper motor can be
operated as very low velocity and no gear is needed for velocity reduction. A
permanent magnet a stator is made up of electromagnets. The motor will
move to align itself to the energized electromagnet.
The field magnets are energized are after the other ground circuit, the motor
can move making either in single step mode or skew mode. Single step mode is
also called as bidirectional mode. The advantages of single step mode are that
each motor step is independent of other step and controller has completed
instantaneous control of motor.
There is other stepper motor based upon variable reluctance principle. In these
motor based upon motor is made up of toothed iron wheel and motor does
not required any excitation. There are hybrid stepper motor which combine
feature permanent magnet and variable reluctance type stepper motor.
Four phased unipolar stepper motors are the most commonly used.
ADDRESS OP-CODE LABEL MNEMONICS COMMENT
7000 12 05 59 BACK LCALL RD79 ; get number from keyboard
7003 12 01 62 LCALL ASTBIN ; get binary equivalent of
that number
7006 B4 01 05 CJNE ; if the number in
A,#01,LOOP accumulator is not equal 01
then go to label LOOP
7009 12 72 00 LCALL 7200 ; go to subroutine at
location 7200
700C 80 06 SJMP ; jump to location 7014
AGAIN
700E B4 02 EF LOOP CJNE A,02, ; if the number in
BACK accumulator is not equal to
02 then go to label BACK
7011 12 73 00 LCALL 7300 ; go to subroutine at
location 7300
7014 22 RET ; end program

ADRESS OP-CODE LABEL MNEMONICS COMMENTS


7200 12 05 59 LCALL RD79 ; get the number from
keyboard
7203 12 01 62 LCALL ASTBIN ; get binary equivalent
of that number
7206 FB mov R3, A ; move content of
accumulator to R3
7207 74 CC movA, #CC ; get #CCH into
accumulator
7209 F5 90 BACK mov P1,A ; send CCH on port 1
720B 79 FF Mov R1, #FF ; move FFH to register 1
720D 7A FF Mov R2, #FF ; move FFH to register 2
720F 12 01 14 LCALL DELAY ; call delay subroutine
7212 12 01 14 LCALL DELAY ; call delay subroutine
7215 23 RLA ; rotate accumulator
content to left
7216 DB F1 DJNZ R3, BACK ; decrement content of
R3 and jump if not zero
to label BACK
7218 32 RETI ; end program

ADDRESS OP-CODE LABEL MNEMONICS COMMENTS


7300 12 05 59 LCALL RD79 ; get number from
keyboard
7303 12 01 62 LCALL ASTBIN ; get binary equivalent of
that number
7306 FB mov R3,A ; move content of
accumulator to R3
7307 74 CC Mov A, #CC ; get CCH into accumulator
7309 F5 90 BACk1 Mov P1,A ; send CCH on port1
730B 79 FF Mov R1, #FF ; move FFH to register1
730D 7A FF Mov R2,#FF ; move FFH to register2
730E 12 01 14 LCALL DELAY ; call delay subroutine
7311 12 01 14 LCALL DELAY ; call delay subroutine
7314 03 RRA ; rotate accumulator
content to right
7315 DB F1 DJNE R3, ; decrement content of R3
BACK1 and jump if not zero to
label BACK1
7317 32 RETI ; end program

Potrebbero piacerti anche