Micro Assignment-1 PDF
Micro Assignment-1 PDF
SUBMITTED BY:
SUBMITTED TO:
PROF.SUNDAR.S
Speed
Packaging
Power consumption
The amount of RAM and ROM on chip
The number of I/O pins and the timer on chip
How easy to upgrade to higherperformance or lower power-consumption versions
Cost per unit
The 8051 family has the largest number of diversified (multiple source)
suppliers like:
A SSI GNMEN T -1 |3
Easily Customizable
Low power consumption
Low cost
Enhanced performance
Disadvantages
Program:
org 0000h
mov p1,#0ffh
mov p2,#00h
here:mov a,p1
cjne a,00111000b,next
setb p2.0
ret
next:nop
A SSI GNMEN T -1 |5
cjne a,00111100b,next1
clr p2.0
ret
next1:nop
sjmp here
end
Output:
ANSWER:
Tabulation 1
4 32 20 20 14 59 3B
5 50 32 25 19 82 52
6 72 48 30 1E 109 6D
7 98 62 35 23 140 8C
8 128 80 40 28 175 AF
Tabulation 2
INPUT(X) DB
0 07H, 00H,00H
1 07H,02H,05H
2 07H,08H,0AH
3 07H,12H,0FH
4 07H,20H,14H
5 07H,32H,19H
6 07H,48H,1EH
7 07H,62H,23H
8 07H,80H,28H
Using the above table we give inputs accordingly to the code and get the
output for given input.
Program:
Org 0000h
Mov dptr,#200h
Mov r0,#3
Loop:clr a
Movc a,@a+dptr
Add a,r2
Jnc next
Inc r3
Mov r2,a
Djnz r0,loop
Org 200h
DB 07h,00h,00h
End
Result: So, using the above code we have added the given input and
generated the output.
Observation: From the above figure, we can visualise that the output
expression has been obtained.
Q3) Write an ALP to toggle bit p1.2 continuously every 50ms.use TIMER 0 to
create the delay.
CPL P1.2
SJMP HERE
RET
END
Calculations:
1) Divide the given time by 1.085usec
Time (T’) = Time/1.085usec = 46,082.9493
Output:
Result: So, using the above code we have generated the waveform with the
given delay.
BASIS FOR
RISC CISC
COMPARISON
Cycles Per Instruction Single cycle for all CPI between 2 and 15.
instructions and an
average CPI < 1.5.
By taking Intel 80836 as example for RISC microprocessor and MIPS R2000
as example for CISC microprocessor distinguished the difference between them.
A S S I G N M E N T - 1 | 11
Q4.B) Give the functionality of the 8051 microcontroller when the following
pins are asserted
a. EA
Pin 30 − This is EA pin which stands for External Access input. It is used to
enable/disable the external memory interfacing.
b. ALE
Pin 31 − This is ALE pin which stands for Address Latch Enable. It is used
to demultiplex the address-data signal of port.
c. PSEN
This is an output pin. PSEN stands for “program store enable.” In an 8031-
based system in which an external ROM holds the program code, this pin is
A S S I G N M E N T - 1 | 12
connected to the OE pin of the ROM. This pin is used to enable external
program memory.
d. INT0
Low level triggered
Whenever a low level is detected on the INT0 pin while global and external
interrupts are enabled, the controller jumps to interrupt service routine (ISR) to
serve interrupt.
Whenever falling edge is detected on the INT0 pin while global and ext. interrupts
are enabled, the controller jumps to interrupt service routine (ISR) to serve
interrupt.
e. RD
RD pin is used as control pin for accessing the external data memory
(External RAM). Pin 17 (RD): Reading Signal to read the contents of
external RAM.
Q5) Read the following program and specify the content in SP register,
content in stack with memory address after execution of each instruction
7 6 5 4 3 2 1 0
cy Ax cy F0 RS1 RS0 ov - p
Banks:
1 0 2
1 1 3
Program: Comment section:
MOV SP,#5FH //moving the stack pointer value to 5FH
Output:
A S S I G N M E N T - 1 | 14
Result: So, using the above code we have pushed or popped back the data in
the given address.
XX:MOV DPTR,#MYDATA
MOV R1,#14
AGAIN1:CLR A
MOVC A,@A+DPTR
CLR TI
DJNZ R1,AGAIN1
SJMP XX
MOV R1,#14
AGAIN:CLR A
MOVC A,@A+DPTR
CLR TI //clear
INC DPTR
DJNZ R1,AGAIN
SJMP XX
MYDATA:DB'GLOBAL WARMING
END
CALCULATIONS:
OUTPUT:
Result: So, using the above code we have transferred the data in accordance
to switch with respective baud rate.
Observation: From the above figure, we can visualise that the data
has been transferred with the given baud rate
Q6)(b) (i) Write an ALP for 8051 to receive bytes of data serially and send
them through port-1.set the baud rate at 4800.
MOV SCON,#50H //SCON register must be filled with 5OH for data transfer
SETB TR1
XX:JNB RI,XX
MOV A,SBUF
MOV P1,A
CLR RI
SJMP XX
END
CALCULATIONS:
Output:
Result: So, using the above code we have RECEIVED the data serially.
Observation: From the above figure, we can visualise that the data
has been received with the given baud rate and can visualize the
received data in port-1.
Q6Bii).Draw the pin out of RS-232 DB9 serial connector. Mention the
functionality of each pin
Answer) The RS-232(X) is a serial communication protocol, commonly used for transferring
and receiving the serial data between two devices. It supports both synchronous and
asynchronous data transmissions. Many devices in the industrial environment are still using RS-
232 communication cable. Rs-232 cable is used to identify the difference of two signal levels
between logic 1 and logic 0. The logic 1 is represented by the -12V and logic 0 is represented the
+12V. The RS-232 cable works at different baud rates like 9600 bits/s, 2400bits/s, 4800bits/s
etc. The RS-232 cable has two terminal devices namely Data Terminal Equipment and Data
communication Equipment. Both devices will send and receives the signals. The data terminal
equipment is a computer terminal and data communication Equipment is modems, or
controllers etc.
The most commonly used type of serial cable connectors are 9-pin connectors DB9 and 25-pin
connector DB-25. Each of them may be a male or female type. Nowadays most of the computers
use the DB9 connector for asynchronous data exchange. The maximum length of RS-232 cable is
50ft.
A S S I G N M E N T - 1 | 19
DB9 PINOUT AND SIGNALS FOR THE PC RS232 CONNECTOR (SERIAL AND
RS232 PORTS)
ORG 0013H
ORG 0030H
XX:SJMP XX
END
A S S I G N M E N T - 1 | 20
Output:
Result: So, using the above code we have switched on the led connected to
pin 1.3.
Observation: From the above figure, we can visualise that switch has
been turned on.
Q8) (A)
IE REGISTER
7 6 5 4 3 2 1 0
EA - ET2 ES ET1 EX1 ET0 EX0
IP REGISTER
7 6 5 4 3 2 1 0
- - PT2 PS PT1 PX1 PT0 PX0
(i) Write the 8051 instructions to enable timer 1 interrupt and external
hardware interrupt 1.
END
A S S I G N M E N T - 1 | 21
(ii) Write the 8051 instructions to make timer 1 interrupt and external
hardware interrupt 1 as highest priority interrupts
END
(iii) After enabling mention all interrupts sorting from highest to lowest
priority.
1) INT1
2) TF1
3) INT0
4) TF0
5) TI & RI
Q8) (B) Write an assembly language program to transfer value 41H serially
(one bit at a time) via pin p2.1.send one low bit at the start and one high bit
at the end of the data. Send the byte LSB first.
Output:
–
Q9 a) List all the steps the ARM core will automatically perform
when an exception causes a mode change
RISC ARCHITECTURE
Q10) Design 8051 based LCD display system with data lines of LCD connected
to the port 0, control signals to port 1. Also develop ALP for the same system
to display “YES”.
(NOTE: 38H-LCD 2 LINES 5x7 Matrix; OEH-display on cursor on; 01H-clear LCD;
06H-Shift cursor right)
ACALL COMMAND
ACALL DELAY
ACALL COMMAND
A S S I G N M E N T - 1 | 25
ACALL DELAY
ACALL COMMAND
ACALL DELAY
ACALL COMMAND
ACALL DELAY
ACALL COMMAND
ACALL DELAY
DELAY:MOV R0,#0FFH
XX:DJNZ R0,XX
RET
COMMAND:MOV P1,A
CLR P2.0
CLR P2.1
SETB P2.2
CLR P2.2
RET
ACALL DATA
ACALL DELAY
MOV A,#'E'
A S S I G N M E N T - 1 | 26
MOV A,#'S'
ACALL DATA
ACALL DELAY
SJMP YY
DATA:MOV P1,A
SETB P2.0
CLR P2.1
SETB P2.2
CLR P2.2
RET