MP & MC2011 Lab Manual
-
Upload
arshad-mohammed -
Category
Documents
-
view
227 -
download
0
Transcript of MP & MC2011 Lab Manual
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 1/51
SIX SEMESTERS
MICROPROCESSOR & MICROCONTROLLER
CONTROL SYSTEM LAB
DEPARTMENT OF ELECTRICAL ENGINEERING
Prepared By: Checked By: Approved By:
Engr. Zubair Khalid Engr. M.Nasim Khan Dr.Noman Jafri
Lecturer (Lab) Electrical, Senior Lab Engineer Electrical, Dean,
FUUAST-Islamabad FUUAST-Islamabad FUUAST-Islamabad
Lab: 1
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 2/51
INTRODUCTION TO 8086 BASED MICROPROCESSOR TRAINER
(IPC-8603)
SYSTEM INTRODUCTION
• IPC-8603 is a single board MICROPROCESSOR TRAINING/DEVELOPMENT KITconfigured around the INTEL’s 16 bit Microprocessor 8086. The system can operate ateither 4.9 MHz or 2.45 MHz .
MEMORY• IPC-8603 provides 16K Bytes of EPROM loaded with monitor and 16K bytes of
• CMOS RAM.
• EPROM : 32K
• RAM : 32K
•
Total Memory = 64K INPUT/OUTPUT• Parallel : 72 I/O lines using 3 nos. of 8255
• Serial : RS-232-C (Main).
• TIMER/COUNTER : Three 16 bit Timer/Counter through 8253.
• Keyboard & Display : 25 keys and 8 Seven Segment display.• BUS : All address, data and control signals (TTL Compatible)
• Interrupt : 8259A , 8 user Interrupt.
• Physical Size : 299mm x 180mm.
• Power Supply : 5V, 1.2 Amps for kit, 12V.
• Operating Temp. : 0 to 50°
IC 82798279 is a general purpose programmable keyboard and display I/O interfacedevice designed for use with the 8086 microprocessor. It provides a scannedinterface to 28 contact key matrix provided in IPC-8603 and scanned displays.
82558255 is a programmable peripheral interface (PPI) designed to use with 8086Microprocessor. This basically acts as a general purpose I/O component tointerface peripheral equipments to the system bus.
8253This chip is a programmable interval timer/counter and can be used for thegeneration of accurate time delays under software control. Various other functionsthat can be implemented with this chip are programmable rate generator.Event Counter, Binary rate multiplier, real time clock etc. This chip has got threeindependent 16 bit counters each having a count rate of up to 2 MHz.
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 3/51
8251
This chip is a programmable communication interface and is used as a peripheraldevice. This device accepts data characters from the CPU in parallel formand then converts them into a continuous serial data stream for transmission.
Simultaneously it can receive serial data stream and converts them into paralleldata characters for the CPU. This chip will signal the CPU whenever it canaccept a new character for transmission or whenever it has received a character for the CPU. The CPU can read the complete status of it at any time. 8251 hasbeen utilized in IPC-8603 for Main/Aux. RS-232-C interface and 20mA currentloop.
INTERFACES
• KEYBOARD DESCRIPTIONThe IPC-8603 has 25 keys and eight seven segment displays to communicatewith outside world. As the power is turned on and Reset key is pressed, amessage -UP 86 is displayed on the display and all the keys are in commandmode. The keyboard is shown below.
• HEXADECIMAL DISPLAY CHARACTERS
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 4/51
Lab: 2
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 5/51
COMMAND DESCRIPTION OF EXAMINE BYTE, EXAMINE
WORD, EXAMINE REGISTER.
HEXADECIMAL KEYPAD LEGEND INTERPRETATION
FUNCTION KEY OPERATION
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 6/51
COMMAND DESCRIPTION
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 7/51
The various commands that can be executed by the monitor are listed below
• EXAMINE BYTE
• EXAMINE WORD
• EXAMINE REGISTER
• INPUT BYTE
• INPUT WORD• OUTPUT BYTE
• OUTPUT WORD
• GO
• MOVE
• STEP
• INSERT
• DELETE
• FILL
• BLANK CHECK
• VERIFY• LIST
• PROGRAM/DUPLICATE
EXAMINE BYTE
EXAMINE WORD
Examine a Series of Memory Byte Locations Relative to the CS Register.
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 8/51
Examining & Modifying Memory Word Location 10H relative to the DS Register.
EXAMINE REGISTER
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 9/51
Lab: 3
EXAMINING AND MODIFYING A REGISTER, EXAMINING A SERIES OFREGISTERS, THE GO (GO) COMMAND, TRANSFERRING CONTROL TO
THE SAMPLE PROGRAM, ENTERING AND EXECUTING A BREAKPOINTIN THE PROGRAM.
Examining and Modifying a Register.
Examining a Series of Registers.
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 10/51
GO
Function
The Go (Go) command is used to transfer control of the 8086 from the keypad
monitor program to a user’s program in memory.
Transferring Control to the Sample Program.
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 11/51
Entering and Executing a Breakpoint in the program.
EPROM PROGRAMMER
IPC-8603 provides onboard EPROM PROGRAMMER for the 2764/27128/27256 EPROMS.
BLANK CHECK
Blank check command is used to check the EPROM placed in the ZIF (Zero Insertion Force)socket for blank.
1) The starting address of the EPROM from where the blank check should start.
2) The End address of the EPROM till where the system should check for blank.
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 12/51
Lab: 4
Introduction to 89S52 & LED Interfacing
Features
• 4.0V to 5.5V Operating Range
• Fully Static Operation: 0 Hz to 33 MHz
•
256 x 8-bit Internal RAM• Three 16-bit Timer/Counters
• Fast Programming Time
• Flexible ISP Programming
Pin Configurations
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 13/51
Block Diagram
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 14/51
LED Code
ORG 000
START:CLR P0.0END
LAB 5:
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 15/51
Blinking LEDs In Different Formations
Objective:
1. Make basic circuitry to run a microcontroller.2. Interfacing LEDs with 89S51 microcontroller.3. Microcontroller programming in C.4. Writing hex code to the microcontroller.5. Running a simple program to blink set of LEDs.6. Interfacing Microcontroller trainer.
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 16/51
C code
#include <reg51.h>#include <stdio.h>void wait (void){ unsigned int x;for (x=0;x<10000;x++)
{}}
void main (void){unsigned int i; /* Delay variable */unsigned char j; /* LED variable */
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 17/51
while (1) /* Loop forever */{for (j=0x01; j< 0x80; j<<=1){ /* Blink LEDs 0, 1, 2, 3, 4, 5, 6 */P2 = j; /* send Output to Port 1 */P0 = j; /* Output to LED Port */
wait (); /* call wait function */}
}
}
ASSEMBLY CODE
ORG 000
START:CLR P0.0ACALL DELAYSETB P0.0ACALL DELAYCLR P0.1ACALL DELAYSETB P0.1ACALL DELAYCLR P0.2ACALL DELAYSETB P0.2ACALL DELAYCLR P0.3ACALL DELAYSETB P0.3ACALL DELAYCLR P0.4ACALL DELAYSETB P0.4ACALL DELAYCLR P0.5ACALL DELAYSETB P0.5ACALL DELAYCLR P0.6ACALL DELAY
SETB P0.6ACALL DELAYCLR P0.7ACALL DELAYSETB P0.7ACALL DELAYACALL DELAY
CLR P0.7ACALL DELAY
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 18/51
SETB P0.7ACALL DELAYCLR P0.6ACALL DELAYSETB P0.6ACALL DELAYCLR P0.5ACALL DELAYSETB P0.5ACALL DELAYCLR P0.4ACALL DELAYSETB P0.4ACALL DELAYCLR P0.3ACALL DELAYSETB P0.3ACALL DELAYCLR P0.2ACALL DELAY
SETB P0.2ACALL DELAYCLR P0.1ACALL DELAYSETB P0.1ACALL DELAYCLR P0.0ACALL DELAYSETB P0.0ACALL DELAYAJMP START
DELAY:
MOV R0,#255BACK: MOV R1,#255
DJNZ R1,$DJNZ R0,BACKRET
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 19/51
LAB 6
7-Segment Interfacing and Programming
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 20/51
ORG 000
START:
MOV P0,#08H ;CODE OF ZERO IN HEX
CLR P2.7 ;PNP TRANSISTER ON
ACALL DELAY ;CALL DELAY ROUTINE
SETB P2.7 ;PNP TRANSISTER OFF
MOV P0,#0EBH ;CODE OF ONE IN HEX
CLR P2.6
ACALL DELAY
SETB P2.6
MOV P0,#092H ;CODE OF TWO IN HEX
CLR P2.5
ACALL DELAY
SETB P2.5
MOV P0,#0C2H ;CODE OF THREE IN HEX
CLR P2.4
ACALL DELAY
SETB P2.4
AJMP START
;DELAY TIME ROUTINE
DELAY:
MOV R1,#20
BACK: MOV R2,#100
DJNZ R2,$
DJNZ R1,BACK
RET
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 21/51
Write code of the following
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 22/51
Lab 7
LCD Interfacing and Programming.
Hardware list
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 23/51
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 24/51
LCD Types Character Locations
Assembly Programming Code
ORG 00
MOV A,#38H ;COMMAND FOR LCD
ACALL COMNWRT ;ROUTINE FOR SENDING COMMANDS TO LCD
ACALL DELAY ;DELAY TIME ROUTINE
MOV A,#38H
ACALL COMNWRT
ACALL DELAY
MOV A,#0EH ;COMMAND FOR DISPLAY ON & CURSOR BLINKING
ACALL COMNWRT
ACALL DELAY
MOV A,#01H ;COMMAND FOR CLEAR DISPLAY SCREEN
ACALL COMNWRT
ACALL DELAY
MOV A,#06H ;COMMAND FOR SHIFT CURSOR TO RIGHT
ACALL COMNWRT
ACALL DELAY
MOV A,#83H ;FORCE CURSOR TO BEGINNING OF IST LINE
ACALL COMNWRT
ACALL DELAY
MOV A,#'W' ;DATA TO WRITE ON LCD
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 25/51
ACALL DATAWRT ;ROUTINE FOR WRITING DATA ON LCD
ACALL DELAY
MOV A,#'E'
ACALL DATAWRT
ACALL DELAY
MOV A,#'L'
ACALL DATAWRT
ACALL DELAY
MOV A,#'L'
ACALL DATAWRT
ACALL DELAY
MOV A,#' '
ACALL DATAWRT
ACALL DELAY
MOV A,#'C'
ACALL DATAWRT
ACALL DELAY
MOV A,#'O'
ACALL DATAWRT
ACALL DELAY
MOV A,#'M'
ACALL DATAWRT
ACALL DELAY
MOV A,#'E'
ACALL DATAWRT
ACALL DELAY
MOV A,#' '
ACALL DATAWRT
ACALL DELAY
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 26/51
MOV A,#'I'
ACALL DATAWRT
ACALL DELAY
MOV A,#'.'
ACALL DATAWRT
ACALL DELAY
MOV A,#'P'
ACALL DATAWRT
ACALL DELAY
MOV A,#'.'
ACALL DATAWRT
ACALL DELAY
MOV A,#'C'
ACALL DATAWRT
ACALL DELAY
SJMP $
COMNWRT:
MOV P1,A
CLR P3.7 ;PIN RS=0
NOP
CLR P3.6 ;PIN READ/WRITE=0
SETB P3.5 ;PIN ENABLE=1
NOP
CLR P3.5 ;PIN ENABLE=0
NOP
RET
DATAWRT:
MOV P1,A
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 27/51
SETB P3.7 ;PIN RS=1
NOP
CLR P3.6 ;PIN READ,WRITE=0
SETB P3.5 ;PIN ENABLE=1
NOP
CLR P3.5 ;PIN ENABLE=0
NOP
RET
DELAY:
MOV R0,#255
DJNZ R0,$
RET
END
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 28/51
Lab 8
Input switch with LCD interfacing
Hardware list
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 29/51
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 30/51
LCD Types Character Locations
Assembly Programming Code
ORG 000
MOV A,#38H ;LCD initialization
LCALL COMMAND
ACALLDELL
MOV A,#38H
LCALL COMMAND
ACALLDELL
MOV A,#0EH
LCALL COMMAND
ACALLDELL
MOV A,#01H
LCALL COMMAND
ACALLDELL
MOV A,#06H
LCALL COMMAND
ACALLDELL
MOV A,#80H
LCALL COMMAND
ACALLDELL
MOV A,#'J'
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 31/51
ACALLDATAR
ACALLDELL
ABC: ;ABC STARTS
CLR P2.7
JB P2.1,ONE
JB P2.2,TWO
JB P2.0,ZERO
AJMP ABC
ZERO:
ACALLDELKEY
MOV A,#'0'
ACALLDATAR
ACALLDELL
;JB P2.0,$
ONE:
ACALL DELKEY
MOV A,#'1'
ACALL DATAR
ACALLDELL
;JB P2.1,$
AJMP ABC
TWO:
ACALLDELKEY
MOV A,#'2'
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 32/51
ACALLDATAR
ACALLDELL
;JB P2.2,$
AJMP ABC
DELL:
DFG: MOV R2,#2
DJNZ R2,$
RET ;ABC RETURNS
COMMAND:
MOV P1,A
CLR P3.7 ;PIN RS=0
NOP
CLR P3.6 ;PIN READ/WRITE=0
SETB P3.5 ;PIN ENABLE=1
ACALL DELL
CLR P3.5 ;PIN ENABLE=0
RET
DATAR:
MOV P1,A
SETB P3.7 ;PIN RS=1
NOP
CLR P3.6 ;PIN READ,WRITE=0
SETB P3.5 ;PIN ENABLE=1
ACALL DELL
CLR P3.5 ;PIN ENABLE=0
RET
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 33/51
DELKEY:
MOV R5,#2
DJNZ R5,$
RET
END
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 34/51
Lab 9
SINGLE PHASE STEPPER MOTOR CONTROL.
A stepper motor is a motor controlled by a series of electromagnetic coils. The center shaft has a series of
magnets mounted on it, and the coils surrounding the shaft are alternately given current or not, creating
magnetic fields which repulse or attract the magnets on the shaft, causing the motor to rotate.
This design allows for very precise control of the motor: by proper pulsing, it can be turned in very
accurate steps of set degree increments (for example, two-degree increments, half-degree increments,
etc.). They are used in printers, disk drives, and other devices where precise positioning of the motor is
necessary.
STEPPER MOTOR
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 35/51
Assembly Code For single phase
ORG 000H
START:
MOV P2,#00010001B
CALL DELAY
MOV P2,#10001000B
CALL DELAY
MOV P2,#01000100B
CALL DELAY
MOV P2,#00100010B
CALL DELAY
JMP START
;==============================
; DELAY 20mS
;==============================
DELAY:
MOV R6,#40
DL1:
MOV R7,#249
DJNZ R7,$
DJNZ R6,DL1
RET
END
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 36/51
Lab 10
DOUBLE PHASE STEPPER MOTOR CONTROL.
A stepper motor is a motor controlled by a series of electromagnetic coils. The center shaft
has a series of magnets mounted on it, and the coils surrounding the shaft are alternately
given current or not, creating magnetic fields which repulse or attract the magnets on the
shaft, causing the motor to rotate.
This design allows for very precise control of the motor: by proper pulsing, it can be turned
in very accurate steps of set degree increments (for example, two-degree increments, half-
degree increments, etc.). They are used in printers, disk drives, and other devices where
precise positioning of the motor is necessary.
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 37/51
Assembly Code For 2- phaseORG000H
START:
MOV P2,#00110011B
CALL DELAY
MOV P2,#10011001B
CALLDELAY
MOVP2,#11001100B
CALL DELAY
MOV P2,#01100110B
CALL DELAY
JMP START
;==============================
; DELAY 20mS
;==============================
DELAY:
MOV R6,#40
DL1:
MOV R7,#249
DJNZ R7,$
DJNZ R6,DL1
RET
END
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 38/51
Write a code to Rotate Stepper Motor At 90 Step
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 39/51
Lab 11
PHOTOINTERRUPTER CONTROL.
Photointerrupters are transmission type sensors incorporating an infrared LED and a
photosensor in the same package. Photointerrupters detect an object when it interrupts thelight beam emitted from the LED. Phototransistors, or digital output photo ICs, can be
selected as the photosensor.
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 40/51
Assembly Code For Photointerrupter
Stepper motor control through Photointerrupter changes the direction from CCW to CW.
ORG 000H
MOV A,#00110011B
TEST:
JBP3.4,TURNR
RL A
MOV P2,A
CALL DELAY
JMP TEST
TURNR:
RR A
MOV P2,A
CALL DELAY
JMP TEST
DELAY:
MOV R6,#20
DL1:
MOV R7,#249
DJNZ R7,$
DJNZ R6,DL1RET
END
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 41/51
Lab 12
PULSE COUNTER.
A pulse counter could be divided in three parts. The first part is a pulses source. The
second unit is microcontroller which counts, memorizes states and prepares results.
Finally, the third part is a converter of electrical states into states available to our senses
i.e. seven segment display .
Photointerrupters are transmission type sensors incorporating an infrared LED and a
photosensor in the same package. Photointerrupters detect an object when it interrupts the
light beam emitted from the LED. Phototransistors, or digital output photo ICs, can be
selected as the photosensor. And this sensor is widely used as a counter. The control
mechanism is designed to count the number of times the path is broken.
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 42/51
Assembly Code For Pulse Counter
ORG 000H
MOV A,#0
MOV P2,#0
NEXT:
JB P3.4,$
ADD A,#1
DA A
MOV P2,A
JNB P3.4,$
JMP NEXT
END
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 43/51
Lab 13
Dot Matrix LED Control.
DOT MATRIX DOT MATRIX
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 44/51
Assembly Programming Code
ORG 000H
CLR P1.7
START:
MOV R0,#64
MOV P2,#FFH
MOV A,#10000000B
NEXT_COL:
MOV P0,A
CALL DELAY
RR A
DJNZ R0,NEXT_COL
MOV R0,#64
MOV P0,#FFH
MOV A,#10000000B
NEXT_ROW:
MOV P2,A
CALL DELAY
RR A
DJNZ R0,NEXT_ROW
JMP START
;==============================
; DELAY 0.1S
;==============================
DELAY:
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 45/51
MOV R6,#200
DL1:
MOV R7,#249
DJNZ R7,$DJNZ R6,DL1
RET
END
Write Assembly code for A.
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 46/51
Lab 14
SPEAKER CONTROL.
The most common type of speaker is the MOVING COIL speaker, where a coil of wire is
suspended in the magnetic field of a circular magnet. When a speech current is passed through
the coil a varying magnetic field is generated by the coil.
The two magnetic fields interact causing movement of the coil. The movement of the coil causes
a cone, which is attached to the coil, to move back and forth. This compresses and decompresses
the air thereby generating sound waves.
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 47/51
Assembly Code For SpeakerORG 000H
START:
MOV R0,#5
NEXT2:
MOV R1,#100
NEXT1:
SETB P3.7
CALL DELAY
CLR P3.7
CALL DELAY
DJNZ R1,NEXT1
DJNZ R0,NEXT2
CALL DL05S
JMP START
; DELAY 0.5mS
DELAY:
MOV R7,#249
DJNZ R7,$
RET
; DELAY 0.5S
DL05S:
MOV R5,#5
DL2:
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 48/51
MOV R6,#200
DL1:
MOV R7,#249
DJNZ R7,$
DJNZ R6,DL1
DJNZ R5,DL2
RET
END
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 49/51
Lab 15
DIGITAL THERMOMETER
Assembly Code For Speaker
ORG 000
CLK = P2.3
DAT = P2.2CS = P2.0MEMDATA = 40H
MOV A,#38HACALL COMMANDACALL DELMOV A,#38HACALL COMMANDACALL DEL
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 50/51
MOV A,#0CHACALL COMMANDACALL DELMOV A,#01HACALL COMMANDACALL DELMOV A,#06HACALL COMMANDACALL DELMOV A,#80HACALL COMMANDACALL DELMOV A,#'T'ACALL DATARACALL DELMOV A,#'E'ACALL DATARACALL DELMOV A,#'M'ACALL DATAR
ACALL DELMOV A,#' 'ACALL DATARACALL DELMOV A,#' 'ACALL DATARACALL DEL
ADC_READ:MOV R2,#9CLR ACLR CLKCLR CS
LOOP:MOV C,DATRLC ASETB CLKNOPCLR CLKDJNZ R2,LOOPMOV MEMDATA,ASETB CSMOV 45H,#8
AGAIN1:
MOV A,MEMDATA
MOV B,#10DIV ABMOV 41H,BMOV B,#10DIV ABORL A,#30HMOV 42H,AMOV A,BORL A,#30HMOV 43H,A
8/7/2019 MP & MC2011 Lab Manual
http://slidepdf.com/reader/full/mp-mc2011-lab-manual 51/51
MOV A,41HORL A,#30HMOV 44H,A
MOV A,#86HACALL COMMANDACALL DELMOV A,42HACALL DATARACALL DELACALL DELMOV A,43HACALL DATARACALL DEL
MOV A,44HACALL DATARACALL DELDJNZ 45H,AGAIN1SJMP ADC_READ
COMMAND:MOV P1,A
CLR P3.7 ;RSNOPCLR P3.6 ;READ/WRITESETB P3.5 ; ENABLENOPCLR P3.5NOPRET
DATAR:MOV P1,A
SETB P3.7 ;RSNOPCLR P3.6 ;READ,WRITESETB P3.5 ; ENABLENOPCLR P3.5NOP
RET