r4 Unit 5 m&m Ppt
r4 Unit 5 m&m Ppt
& UNIT-V
MICROCONTROLLER
By: Sakshi Mittal
UNIT V: Assembly programming and KEC-
instruction of 8051 502
Interfacing:
• LCD & Keyboard Interfacing
• ADC, DAC & Sensor Interfacing
• Stepper motor Interfacing
LCD AND KEYBOARD
INTERFACING
D0-D7:
• The digital data output pins.
• These are tri-state buffered .The converted data is accessed only when CS
= 0 and RD is forced low.
• To calculate the output voltage, use the following formula:
where D0 is the LSB, D7 is the MSB for the inputs, and Iref is the input
current that must be applied to pin 14. The Iref current is generally set to
2.0 mA. Figure 13-18 shows the generation of current reference (setting Iref
= 2 mA) by using the
standard 5-V power supply and IK and 1.5K-ohm standard resistors. Some
INTERFACING DAC0808:
DATA TABLE FOR SINE WAVE GENERATION
DAC INTERFACING
START:MOV DPTR,#TABLE
MOV R1,#13
CLR A
LOOP: MOVC A,@A+DPTR
MOV P1,A
INC DPTR
DJNZ R1,LOOP
SJMP START
TABLE: ORG 200H
DB 128,192,238,255,238,192,128,64,17,0,17,64,128
SENSOR INTERFACING
• Half Drive Mode − In this mode, one and two coils are
energized alternately. At first, one coil is energized then two
coils are energized. This is basically a combination of wave
and full drive mode. It increases the angular rotation of the
motor
STEPPER MOTOR
INTERFACING
Port P2 of 8051 has been
used for connecting 6 wires
Unipolar Stepper Motor the
stepper motor.
•Only four wires are required
to control the stepper motor.
•Two common wires of
stepper motor connected to
the 5V supply.
Here, ULN2003 is used to
drive stepper motor.
This is basically a high
voltage, high current
Wave Drive Mode Program:
• ORG 00H
• MOV TMOD, #01H
To generate a delay of 200 *1 ms
• MAIN:
• MOV P2, #08H DELAY:MOV R0,#200 //change this value to
• ACALL DELAY required delay in ms
• MOV P2, #04H BACK: MOV TH0,#0FCH
MOV TL0,#018H
• ACALL DELAY
SETB TR0
• MOV P2, #02H wait: JNB TF0,wait
• ACALL DELAY CLR TR0
• MOV P2, #01H CLR TF0
DJNZ R0,BACK
• ACALL DELAY
RET
• SJMP MAIN END
Full Drive Mode:
• ORG 00H
• ACALL DELAY
• MOV • SJMP MAIN
TMOD,#01H
• MAIN:
• MOV P2, #0CH
• ACALL DELAY
• MOV P2, #06H
• ACALL DELAY
• MOV P2,
THANK YOU!!