Embedded Systems Lab Manual Exp. 1-4
Embedded Systems Lab Manual Exp. 1-4
Embedded Systems Lab Manual Exp. 1-4
EXPERIMENT NO. 1
APPARATUS:
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
Keyboard
Printer
video game player
MP3 music players
Embedded memories to keep configuration information
Mobile phone units
Domestic (home) appliances
Data switches
Automotive controls
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.
EXPERIMENT NO. 2
OBJECT: Data transfer instruction using different addressing modes and block transfer.
APPARATUS:
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
If the instruction is associated with more than one operand, the format is always:
o Register addressing
o Direct addressing
o Indirect addressing
o Immediate addressing
o Implied/Implicit addressing
Register Addressing:
In register addressing mode, the instruction specifies the name of the register in which the data is
available.
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.
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;
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.
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.
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
Implied Addressing
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
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
Table 2.10 Result of a program to transfer a block of data from one memory location to another memory
location
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:
THEORY:
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.
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.7 Assembly Language Program for Integer Division of Two 8-Bit Numbers
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.
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:
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.
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.
Assembly Language program that DAC output gives ramp and triangular waveforms.
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
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
Result: We have written the assembly language program for generation of simple wave forms
such as triangular, ramp, Square etc.