Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
100% found this document useful (1 vote)
607 views18 pages

Embedded Systems Lab Manual Exp. 1-4

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 18

Swami Keshvanand Institute of Technology, Management & Gramothan

Ramnagaria (Jagatpura) Jaipur-302017

EXPERIMENT NO. 1

OBJECT: Introduction to embedded system and their working.

APPARATUS:

S.NO. EQUIPMENT QUANTITY


1 8085-Microprocessor Kit 1
2 8051-Microcontroller Kit 1
3 Power Supply (5V) 1

THEORY: Embedded System”, “A combination of hardware and software”. An embedded


system can be defined as a computer hardware system having software embedded in it.
An embedded system can be an independent system or it can be a part of a large system.
An embedded system is a microcontroller or microprocessor-based system which is designed to
perform a specific task.

Parts of an embedded systems

 The hardware components constitute power source, microcontroller/microprocessor,


timers, memory, and whatever needed for running the specific task.
 The software components constitute programs such as compilers, integrated
development environments (IDE), assemblers, simulators etc., which are used to create
codes that “instruct” the hardware to do the assigned job in an efficient manner.

Microcontroller/microprocessor is analogous to the brain of the embedded system. It performs


all the calculation and decision part of the process. The only arithmetic operation the
processor/controller is capable of doing is, addition! (and the modern computer too).
Multiplication is repeated addition; subtraction is the addition of negative numbers and
division is repeated addition of negative numbers. In most of the embedded systems, a
microcontroller is chosen. The microcontroller integrates many useful components such as
memory, timers, counters, ADC, DAC etc onto the same package along with the controller. In
contrast, for a microprocessor, timers, counters are to be provided separately and memory

7EE4-21 Embedded Systems LAB/EED SKIT Jaipur Page 1


Swami Keshvanand Institute of Technology, Management & Gramothan
Ramnagaria (Jagatpura) Jaipur-302017

should also be interfaced separately which involves some additional circuitry and again which
eats more space.

One of the major goals of embedded system devices is compactness. Hence, embedded system
vendors mostly adopt for microcontrollers. This doesn’t mean that microprocessor is less
applicable! It is as important as the microcontroller which has its own applications. In general,
the microcontroller is designed for a specific purpose. [For example, an automatic washing
machine, a cell phone etc. Of course, you can implement the same cell phone with a
microprocessor, but it takes too much space and also as much circuitry is involved, more
power is consumed.]

Thus, an embedded system is closely integrated with the main system. It may not interact
directly with the environment. For example – A microcomputer in a car ignition control

❖ An embedded product uses a microprocessor or microcontroller to do one task


only.
❖ There is only one application software that is typically burned into ROM.

Examples of Embedded Systems

 Keyboard
 Printer
 video game player
 MP3 music players
 Embedded memories to keep configuration information
 Mobile phone units
 Domestic (home) appliances
 Data switches
 Automotive controls

Applications of embedded systems

Traffic control system

7EE4-21 Embedded Systems LAB/EED SKIT Jaipur Page 2


Swami Keshvanand Institute of Technology, Management & Gramothan
Ramnagaria (Jagatpura) Jaipur-302017

Embedded system integrated traffic lights can detect which directions have the highest density
of traffic and change the traffic lights and their timings based on this info. This will be a great
boon to cities that are controlled by fixed timer traffic lights.

Smart homes

IOT (Internet of Things) is closely knitted with embedded systems. All the appliances of a
smart home which can be controlled via the internet are integrated with embedded systems.

Healthcare

A lot of instruments used in healthcare like blood pressure monitor, scanners, pacemakers etc
works with the help of embedded systems.

Automotive industry

Vehicles are equipped with embedded systems. Major functions like temperature control (AC),
ABS, airbags, automatic rain sensor wipers etc. are controlled by these systems.

CONCLUSION: Thus, the embedded system can be made up of both microprocessor or


Microcontroller.

7EE4-21 Embedded Systems LAB/EED SKIT Jaipur Page 3


Swami Keshvanand Institute of Technology, Management & Gramothan
Ramnagaria (Jagatpura) Jaipur-302017

EXPERIMENT NO. 2

OBJECT: Data transfer instruction using different addressing modes and block transfer.

APPARATUS:

S.NO. EQUIPMENT QUANTITY


1 8085-Microprocessor Kit 1
2 Power Supply (5V) 1

THEORY:

A computer instruction is made up of an operation code (op-code) followed by either zero, one
or two bytes of operands. The op-code identifies the type of operation to be performed while the
operands identify the source and destination of the data

• The operand can be:


o The data value itself
o A CPU registers
o A memory location

If the instruction is associated with more than one operand, the format is always:

Instruction Destination, Source

8085 Addressing Modes

o Register addressing
o Direct addressing
o Indirect addressing
o Immediate addressing
o Implied/Implicit addressing

7EE4-21 Embedded Systems LAB/EED SKIT Jaipur Page 4


Swami Keshvanand Institute of Technology, Management & Gramothan
Ramnagaria (Jagatpura) Jaipur-302017

Register Addressing:

In register addressing mode, the instruction specifies the name of the register in which the data is
available.

EX. MOV A, B - Move the content of B register to A register; ADD C

Table 2.1 Assembly Language Program for transfer data between two registers
Memory Hex Mnemonics
Label Comments
Address Code Opcode Operand
C000H 0EH MVI B,09H Move data into register.
C001H 09H
C002H 78H Move data from register B to
MOV A, B
A.
C003H 32H Store the result at the location
STA C050H
MC050H.
C004H 50H
C005H C0H
C006H 76H HLT Stop the program.

Table 2.2 Result of data transfer between two registers

Before Execution After Execution


Memory Address Content Memory Address Content
MC001H 09H MC050H 09H

Direct Addressing

In direct addressing mode, the address of the data is specified in the instruction. The data will be
in memory. In this addressing mode, the program instructions and data can be stored in different
memory.

EX. LDA Load the data available in memory location 2050H in to accumulator;

7EE4-21 Embedded Systems LAB/EED SKIT Jaipur Page 5


Swami Keshvanand Institute of Technology, Management & Gramothan
Ramnagaria (Jagatpura) Jaipur-302017

Table 2.3 Assembly Language Program for transfer data using direct addressing mode
Memory Hex Mnemonics
Label Comments
Address Code Opcode Operand
C000H 3AH Load the data from 2050H in
LDA 2050H
to accumulator
C001H 50H
C002H 20H
C003H 32H Store the result at the location
STA C040H
MC040H.
C004H 40H
C005H C0H
C006H 76H HLT Stop the program.

Table 2.4 Result of data transfer using direct addressing mode

Before Execution After Execution


Memory Address Content Memory Address Content
MC050H 08H MC040H 08H

Indirect Addressing

In indirect addressing mode, the instruction specifies the name of the register in which the
address of the data is available. Here the data will be in memory and the address will be in the
register pair.

EX. MOV A, M - The memory data addressed by H L pair is moved to A register.

LDAX B

Table 2.5 Assembly Language Program for transfer data using Indirect addressing mode
Memory Hex Mnemonics
Label Comments
Address Code Opcode Operand
C000H 01H Load the data C050H in to
LXI B, C050H
BC register pair
C001H 50H
C002H C0H
C003H 11H Load the data C040H in to
LXI D, C040H
DE register pair
C004H 40H
C005H C0H
C006H 0AH LDAX B Load the data to
7EE4-21 Embedded Systems LAB/EED SKIT Jaipur Page 6
Swami Keshvanand Institute of Technology, Management & Gramothan
Ramnagaria (Jagatpura) Jaipur-302017

accumulator from memory


address stored in BC
register pair
C007H Store the data from
accumulator to memory
12H SDAX D
address stored in DE
register pair
C008H 76H HLT Stop the program.

Table 2.6 Result of data transfer using Indirect addressing mode

Before Execution After Execution


Memory Address Content Memory Address Content
MC050H 07H MC040H 07H

Implied Addressing

In implied addressing mode, the instruction itself specifies the


data to be operated.

EX. CMA - Complement the content of accumulator; RLC, RRC

Table 2.7 Assembly Language Program for transfer data using Implied addressing mode
Memory Hex Mnemonics
Label Comments
Address Code Opcode Operand
C000H 3EH MVI A,05H Move data into accumulator.
C001H 05H
C002H 2FH Complement the content of
CMA
accumulator
C002H 32H Store the result at the location
STA C050H
MC050.
C003H 50H
C004H C0H
C005H 76H HLT Stop the program.

Table 2.8 Result of data transfer between using Implied addressing mode

Before Execution After Execution


Memory Address Content Memory Address Content
MC001H 05H MC050H 50H

7EE4-21 Embedded Systems LAB/EED SKIT Jaipur Page 7


Swami Keshvanand Institute of Technology, Management & Gramothan
Ramnagaria (Jagatpura) Jaipur-302017

Block Transfer

Transfer a block of data from one memory location to another memory location.

Table 2.9 Assembly Language Program for transfer a block of data from one memory location to another
memory location
Mnemonics
Memory Hex
Label Opcod Comments
Address Code Operand
e
C000H 01H Load the data C050H in to
LXI B, C040H
BC register pair
C001H 40H
C002H C0H
C003H 11H Load the data C040H in to
LXI D, C050H
DE register pair
C004H 50H
C005H C0H
C006H 26H MVI H, 06H Move data to register
C007H 06H
C008H 0AH BACK Load the data to
accumulator from memory
LDAX B
address stored in BC
register pair

C007H Store the data from


accumulator to memory
12H SDAX D
address stored in DE
register pair
03H Increment register pair by
INX B
one
13H Increment register pair by
INX D
one
25 DCR H decrement register by one
C2 Jump at memory location
JNZ BACK
C008H
C008H 76H HLT Stop the program.

Table 2.10 Result of a program to transfer a block of data from one memory location to another memory
location

7EE4-21 Embedded Systems LAB/EED SKIT Jaipur Page 8


Swami Keshvanand Institute of Technology, Management & Gramothan
Ramnagaria (Jagatpura) Jaipur-302017

Before Execution After Execution


Memory Address Content Memory Address Content
MC040H 07H MC050H 07H
MC041H
06 MC051H 06
MC042H
04 MC052H 04
MC043H
08 MC053H 08
MC044H
03 MC054H 03
MC045H
02 MC055H 02

CONCLUSION: We have written the assembly language program for transfer dada in different
addressing modes and block transfer from one memory location to another memory location. and
observed results.

EXPERIMENT NO. 3

OBJECT: Write a program for arithmetic operations in binary and BCD- addition,
subtraction, multiplication and division and display.

APPARATUS:

S.NO. EQUIPMENT QUANTITY


1 8085-Microprocessor Kit 1
2 Power Supply (5V) 1

THEORY:

Table 3.1 Assembly Language Program to add two 8-bit numbers

7EE4-21 Embedded Systems LAB/EED SKIT Jaipur Page 9


Swami Keshvanand Institute of Technology, Management & Gramothan
Ramnagaria (Jagatpura) Jaipur-302017

Memory Hex Mnemonics


Label Comments
Address Code Opcode Operand
C000H 3EH MVI A, 04H Move data into Accumulator.
C001H 04H
C002H 06H MVI B, 06H Move data into register.
C003H 06H
C004H Add the content of B register
80H ADD B to accumulator & store result
in A
C005H Store the result at the location
32H STA C050H
MC050.
C006H 50H
C007H C0H
C008H 27H Decimal Adjustment of
DAA
accumulator
C009H 32H Store the result at the location
STA C051H
MC051H.
C00AH 51H
C00BH C0H
C00CH 76H HLT Stop the program.

Table 3.2 Result of addition of two 8-bit numbers

Before Execution After Execution


Memory Address Content Memory Address Content
MC001H 04H MC050H 0AH
MC003H 06H MC051H 10 BCD

The BCD Subtraction using 10s Complement can be used to perform subtraction by adding
the minuend to the 10s Complement of the subtrahend and dropping the carry.

Table 3.3 Assembly Language Program to subtract two 8-bit numbers


Memory Hex Mnemonics
Label Comments
Address Code Opcode Operand
C000H 0EH MVI C, 35H Move data into register.
C001H 35H
C002H 3EH MVI A, 99H Move data into Accumulator.
C003H 99H
C004H 91H SUB C Subtract the content of C
register from accumulator &

7EE4-21 Embedded Systems LAB/EED SKIT Jaipur Page 10


Swami Keshvanand Institute of Technology, Management & Gramothan
Ramnagaria (Jagatpura) Jaipur-302017

store result in A
C005H 3CH INR A Increment A by one
C006H 47H MOV B, A Move data from A to B.
C007H 3EH MVI A,72H Move data into Accumulator.
C008H 72H
C009H 80H Add the content of B register
ADD B to accumulator & store result
in A
C00AH 27H Decimal Adjustment of
DAA
accumulator
C00BH 32H Store the result at the location
STA C040H
MC040H.
C00CH 40H
C00DH C0H
C00EH 3EH MOV A,72H Move data into Accumulator.
C00FH 72H
C010H 91H Subtract the content of C
SUB C register from accumulator &
store result in A
C011H 32H Store the result at the location
STA C041H
MC040H.
C012H 41H
C013H C0H
C014H 76H HLT Stop the program.

Table 3.4 Result of subtraction of two 8-bit numbers

Before Execution After Execution


Memory Address Content Memory Address Content
MC001H 35H MC040H 3DH
MC008H 72H MC0041H 37BCD

Table 3.5 Assembly Language Program to multiply two 8-bit numbers


Mnemonics
Memory Hex
Label Opcod Comments
Address Code Operand
e
C000H 3EH MVI A, 00H Move data into Accumulator.
C001H 00H
C002H 06H MVI B, 05H Move data into register.
C003H 05H
C004H 0EH MVI C,03H Move data into register.
C005H 03H
7EE4-21 Embedded Systems LAB/EED SKIT Jaipur Page 11
Swami Keshvanand Institute of Technology, Management & Gramothan
Ramnagaria (Jagatpura) Jaipur-302017

C006H Add the content of B register


80H BACK ADD B to accumulator & store result
in A
C007H 0DH DCR C Decrement in by one
C008H C2H JNZ C006H Jump on no zero at C006H
C009H 06H
C00AH C0H
C00BH Store the result at the location
32H STA C050H
MC050.
C00CH 50H
C00DH C0H
C00EH 27H Decimal Adjustment of
DAA
accumulator
C00FH 32H Store the result at the location
STA C051H
MC051H.
C010H 51H
C011H C0H
C012H 76H HLT Stop the program.

Table 3.6 Result of multiplication of two 8-bit numbers

Before Execution After Execution


Memory Address Content Memory Address Content
MC003H 05H MC050H 0FH
MC005H 03H MC0051H 15 BCD

Table 3.7 Assembly Language Program for Integer Division of Two 8-Bit Numbers

Memory Hex Mnemonics


Label Comments
Address Code Opcode Operand
C000H 3EH MVI A,09H Move data into accumulator.
C001H 09H
C002H 0EH MVI B,03H Move data into register.
C003H 03H
C004H 1EH MVI E,00H Move data into register.
C005H 00H
C006H 91H LOOP Subtract accumulator from
SUB B
register C.
C007H 1CH INR E Increment in register E.
C008H B8H CMP B
C009H D2H JNC C006H Jump on no carry at the

7EE4-21 Embedded Systems LAB/EED SKIT Jaipur Page 12


Swami Keshvanand Institute of Technology, Management & Gramothan
Ramnagaria (Jagatpura) Jaipur-302017

location C006H
C00AH 06H
C00BH C0H condition of no carry
C00CH 7BH Move data from register E to
MOV A, E
A.
C00DH 32H Store the result at the location
STA C050H
MC050.
C00EH 50H
C00FH C0H
C010H 27H Decimal Adjustment of
DAA
accumulator
C011H 32H STA C051H
C012H 51H
C013H C0H
C014H 76H HLT Stop the program.

Table 3.8 Result of Integer Division of Two 8-Bit Numbers

Before Execution After Execution


Memory Address Content Memory Address Content
MC001H 09H MC050H 03H
MC003H 03H

Result: We have written the assembly language program for binary and BCD- addition,
subtraction, multiplication and division and observed results.

EXPERIMENT NO. 4

OBJECT: Interfacing D/A converter & Write a program for generation of simple wave
forms such as triangular, ramp, Square etc.

APPARATUS:

S.NO. EQUIPMENT QUANTITY

7EE4-21 Embedded Systems LAB/EED SKIT Jaipur Page 13


Swami Keshvanand Institute of Technology, Management & Gramothan
Ramnagaria (Jagatpura) Jaipur-302017

1 8051-Microcontroller Kit 1
2 Power Supply (5V) 1

THEORY:

Microcontroller are used in wide variety of applications like for measuring and control of
physical quantity like temperature, pressure, speed, distance, etc. In these systems
microcontroller generates output which is in digital form but the controlling system requires
analog signal as they don't accept digital data thus making it necessary to use DAC which
converts digital data into equivalent analog voltage.Digital to Analog Converter is a device used
to convert digital pulses to analog signals.

In the figure shown, we use 8-bit DAC 0808. This IC converts digital data into equivalent
analog current. Hence, we require an I to V converter to convert this current into equivalent
voltage.

• DAC0808 provides 256 discrete voltage (or current) levels of output.


• 8-bit current output monolithic DAC.
• DAC 0808 is16 pin IC.
• 8 input lines (digital input).
• Single output line (current).

7EE4-21 Embedded Systems LAB/EED SKIT Jaipur Page 14


Swami Keshvanand Institute of Technology, Management & Gramothan
Ramnagaria (Jagatpura) Jaipur-302017

Fig.4.1 Pin Diagram of DAC 0808 IC

In the MC1408 (DAC0808), the digital inputs are converted to current (I out), and by
connecting a resistor to the Iout pin, we convert the result to voltage. The total current provided
by the Iout pin is a function of the binary numbers at the D0 – D7 inputs of the DAC0808 and
the reference current (Iref), and is as follows:

where D0 is the LSB, D7 is the MSB for the inputs, and I ref is the input current that must be
applied to pin 14. The Iref current is generally set to 2.0 mA.

8051 Interfacing with DAC

7EE4-21 Embedded Systems LAB/EED SKIT Jaipur Page 15


Swami Keshvanand Institute of Technology, Management & Gramothan
Ramnagaria (Jagatpura) Jaipur-302017

Fig.4.2 Interfacing Diagram of DAC with 8051

Assembly Language program that DAC output gives ramp and triangular waveforms.

7EE4-21 Embedded Systems LAB/EED SKIT Jaipur Page 16


Swami Keshvanand Institute of Technology, Management & Gramothan
Ramnagaria (Jagatpura) Jaipur-302017

ORG,00H
MOV A, #00H; Move data to Accumulator
MOV P1, A; Make port as output port
AGAIN: MOV A, #00H; Move real data to Accumulator
INCR: MOV P1, A; Move data from Accumulator to port
INC A; Increment A by one
CJNE A, #0FFH, INCR; Compare A with FFH and jump to level if not equal
DECR: MOV P1, A; Move data from Accumulator to port
DEC A; Increment A by one
CJNE A, #00H, DECR; Compare A with 00H and jump to level if not equal
SJMP AGAIN; Repeat for next cycle
Output Waveform

Assembly Language program that DAC output gives square waveform

Main Program
ORG,00H
MOV A, #00H; Move data to Accumulator
MOV P1, A; Make port as output port
Back: MOV A, #00H; Move real data to Accumulator
MOV P1, A; Move data from Accumulator to port
CALL DELAY; Call to delay subroutine program
MOV A, #0FFH; Move real data to Accumulator
MOV P1, A; Move data from Accumulator to port
CALL DELAY; Call to delay subroutine program
SJMP back; Repeat for next cycle
Subroutine Program
DELAY:
7EE4-21 Embedded Systems LAB/EED SKIT Jaipur Page 17
Swami Keshvanand Institute of Technology, Management & Gramothan
Ramnagaria (Jagatpura) Jaipur-302017

MOV R2, #0FFH


Here1: MOV R1, #0FFH
Here: DJNZ R1 Here
DJNZ R2 Here1
RET
Output Waveform

Result: We have written the assembly language program for generation of simple wave forms
such as triangular, ramp, Square etc.

7EE4-21 Embedded Systems LAB/EED SKIT Jaipur Page 18

You might also like