MC Unit-5
MC Unit-5
Why do we need additional pins when we have Ports on the 8051 already?
Components Required
1. 8051Microcontroller.
2. 8255 Programmable Peripheral Interface
3. Decoder circuit–74LS373 (for address demultiplexing)
4. NAND gate IC–74LS00
5. NOT gate IC–74LS04
For a microcontroller to interface with 8255, a LOW pulse is given to the Chip
Select pin of 8255 as it is an active low pin
The output of the NAND gate is LOW. When ALL the inputs are HIGH.
Therefore, from the address allocations that we have done,
A7=0,A6=0,A5=1,A4=0,A3=0,A2=0
Step1:Constructthecontrolwordregister
D7=1, this will make all the ports of 8255 PPI are in the I/O mode.
D6 = D5 =D2= 0: selects mode 0 for Port A, Port B, and Port C.
D4= D1= 1: To select Port A and Port B as input ports.
D3=D0=0: To select both lower and upper Port C as output port.
ORG 0000H
MOV A,#92H
MOV DPTR,#CNTPORT
MOVX @DPTR,A
MOV DPTR,#PORTA
MOVX A,@DPTR
MOV R0,A
MOV DPTR,#PORTB
MOVX A,@DPTR
MOV R1,A
MOV A,R0
ADD A,R1;
MOV DPTR,#PORTC
MOVX @DPTR,A
END
Note:For Reference
INTERFACING OF LM35 TEMPERATURE SENSOR WITH 8051
The main principle of this circuit is to take the analog temperature values,
convert into digital values and displays the digital temperature value on LCD or
7-Segment Display using 8051MC.
• RD,WR and INTR of ADC is connected to P2.5, P2.6 and P2.7 respectively.
• Here WR is for the start of conversion and INTR is for the end of conversion.
Interfacing DAC with 8051
• Microcontroller are used in wide variety of applications like for
measuring and control of physical quantity like temperature,
pressure, speed, distance, etc.
Stator: The stator is the stationary part which provides the magnetic field to rotate
the rotor. The stator is made up of coils that are energized by the pulses
Rotor: The rotor is the non-stationary part of a motor, the steps of the rotor and
alignment with the stator determines the step angle and steps per revolution.
Permanent magnets: The rotor is mounted on a permanent magnet that attracts
or repels the stator coils and hence the propulsion occurs.
Diagram show the interfacing of stepper motor with 8051 microcontroller, using
Port 2 of 8051 to generate pulses and port 2 is connected to a current amplifier IC
ULN2003, to amplify the current to drive the stepper motor using the pulse of the
microcontroller.
Block diagram of interfacing of stepper motor with 8051:
ORG 00H
MOV TMOD, #01H
MAIN: MOV P2, #08H
ACALL DELAY
MOV P2, #04H
ACALL DELAY
MOV P2, #02H
ACALL DELAY
MOV P2, #01H
ACALL DELAY
SJMP MAIN
Delay Program: