MP & DSP Lab Manual
MP & DSP Lab Manual
MADANAPALLI
ANGALLU, MADANAPALLE 517 325
DEPARTMENT
OF
ELECTRONICS & COMMUNICATION ENGINEERING
MARCH - 2012
MITS
LAB WISE-LAB MANUALS
MITS/ECE
DEPARTMENT : ECE
DEPARTMENT
OF
ELECTRONICS & COMMUNICATION ENGINEERING
MARCH 2012
TABLE OF CONTENTS
Microprocessors Programming (8086)-Trainer Kit
S.NO
ALP Program to
A) Addition of two 8-bit numbers
B) Addition of two 16-bit numbers
C) Addition of two 32-bit numbers
ALP Program to
A) Subtraction of two 8-bit numbers
B) Subtraction of two 16-bit numbers
ALP Program to
A) Multiplication of two 8-bit numbers
B) Multiplication of two 16-bit numbers
ALP Program to
A) Division of 16 - bit number by 8 - bit number
B) Division of 32 - bit number by 16 - bit number
10
11
ALP Program to
A) Hexadecimal to Decimal Number
B) Decimal to Hexadecimal Number
12
13
A)
Signed Multiplication
B)
Signed Division
10
A)
B)
A)
Block move
D)
String comparison
E)
String insertion
F)
String deletion
G)
Generation of positive RAMP wave using DAC Generation of triangular wave using DAC
8051 Microcontrollers
1
8051 Timers
2s compliment
8-bit subtraction
8-bit division
Sum of n-number
10
11
12
13
Generation of 00 to 0f numbers
SPECIFICATIONS
CPU:Intel 8086 operating at 5MHz in MAX mode; provision for onboard 8087 Co-processor
MEMORY: Total 256KB of memory is provided in the kit
EPROM:2JEDEC compatible sockets for EPROM;Onboard EPROM capacity is 256KB
(27C010X2)
128KB of EPROM containing keyboard/serial monitor will be supplied.
RAM:
2 JDEC compatible sockets are provided for RAM.
64KB of ram will be 62256X2 will be supplied.
PARALLEL I/O48 I/O lines using two 8255s
SERIAL I/O: One RS 232C compatible interface using USART 8251A,with hardware
selectable baudrate using one channel of 8253 timer with MAX 232C IC
TIMER:Three 16 bit counter/ timers using 8253A counter 1 is used for serial I/O baudrate
generation
PIC: Programmable interrupt controller using 8259A provides interrupt vectors for 8 jumper
selectable internal/ external sources
KEYBOARD/ DISPLAY :
KEYBOARD: Computer keyboard can be hocked on to the trainer.
DISPLAY:
LCD 2x16display:
INTERRUPTS:
NMI: Provision for connecting NMI to a key switch.
INTR: Programmable interrupt controller using 8259A provides interrupt vectors for 8 jumper
selectable/external source. On board interrupt source include: 8251A
TXRDY and RXRDY, 8255 and 8087.
INTERFACE BUS SIGNALS
CPU BUS: All address, data and center lines ate TTL compatible and are terminated in berg
strip header
PARALLER I/O: All signals are TTL compatible and terminated in berg strip headers for PPI
expansion. Its compatible with all of our experimental interface modules.
SERIAL I/O: Serial port signals are terminated in standard 9 pin D type connecter.
MONITOR SOFTWARE: 128 KB of serial/ keyboard monitor with powerful commands to
enter verify and debug user programs, including on board assembler &disassemble commands.
8
COMPUTER INTERFACE This can be interfaced to host computer system through the main
serial port; The driver program or communication between computer and trainer allows the
computer to be used as a simple dumb terminal and also facilitates uploading
POWER REQUIREMENTS: +5V DC, with 2.5 Amps current rating(max).
OPERATING CONFIGURATION: Two different modes of operation of trainer are possible.
They are:
i)
serial operation
ii)
Keyboard operation
The first configuration requires a computer system with an RS -232C port, can be used as the
controlling device as shown below.
RS 232C
CABLE
Computer
Trainer
When a Computer system is interfaced to trainer, the driver program must be resident in the
computer system.
The second mode of operation id achieved through onboard KEYBOARD/DISPAY.
In this mode the trainer kit interacts with the user through a computer keyboard and 16x2 LCD
display. This configuration eliminates the need for a computer and offers a convenient way for
using the trainer as a stand alone system.
START
STOP
10
PROG 1
RESULT: Thus the initialization of the register with immediate data has been executed successfully
and the result is verified.
11
START
STOP
12
PROG 2
AIM:
program initializes the registers with immediate data
APPARATUS:
ALS-86 p kit.
Key board
Power supply
ALGORITHM:
1. Start.
2. Load content in AX Register from memory location 4100
3. Load content in BX Register from memory location 4102
4. Load content in CX Register from memory location 4104
5. Load content in DX Register from memory location 4106
6. Load content in SI Register from memory location 4108
7. Load content in DI Register from memory location 410A
8. End program
INPUT :4100 : 1111
4102 : 2222
4104 : 3333
4106 : 4444
4108 : 5555
410A: 6666
OUTPUT:AX = 1111,
BX= 2222,
CX= 3333,
DX=4444,
SI=5555,
DI= 6666.
RESULT: Thus the date is moved from memory to the registers has been executed successfully and the
result is verified.
13
START
PUSH DS
POP ES
Load CX with 09
MOVSB
NO
CX=0
YES
STOP
14
Stop
15
PROG 3
AIM:
program to move a block of memory from one memory location to other
APPARATUS:
ALS-86 p kit.
Key board
Power supply
ALGORITHM:
1. Start.
2. Load the source Index with starting memory address of content
3. Load the destination Index where to store the memory content
4. Initialize the counter CX with value 10
5. Push the contents on to the stack and pop the contents from the stack and
store in the memory location pointed by the DI
6. Repeat the step 5 for 10 times until CX becomes 0.
7. End of program
16
PROG 4
AIM:
Write a program to interchange two words
APPARATUS:
ALS-86 p kit.
Key board
Power supply
ALGORITHM:
1.
2.
3.
4.
5.
6.
7.
INPUT
:-
RESULT: Thus the program to interchange two words has been executed successfully and the
result is verified.
17
Start
Stop
18
PROG 5 (A)
AIM:
To perform the addition of two 8 bit numbers using 8086
APPARATUS:
ALS-86 p kit.
Key board
Power supply
ALGORITHM:
1.
2.
3.
4.
5.
6.
INPUT
:-
4100 : 45
4101 : 55
OUTPUT:-
4102 : 9A
RESULT: Thus the addition of two 8-bit numbers has been executed successfully using 8086
microprocessor and the result is verified.
19
PROG 5 (B)
AIM:
To perform the addition of two 16- bit numbers using 8086
APPARATUS:
ALS-86 p kit.
Key board
Power supply
ALGORITHM:
1.
2.
3.
4.
5.
6.
7.
INPUT
:-
start
Initialize the segment address & clear the carry flag
Initialize the destination address
Move the first 8-bit number to AX register
Move the second 8-bit number to BX register
Add the contents of AX and BX and store result in AX
End of program
4100 : ABCD
4102 : 1111
RESULT: Thus the addition of two 16-bit numbers has been executed successfully using 8086
microprocessor and the result is verified
20
Start
Stop
21
PROG 5 (C)
AIM:
To perform the addition of two 32 bit numbers using 8086
APPARATUS:
ALS-86 p kit.
Key board
Power supply
ALGORITHM:
1.
2.
3.
4.
5.
6.
7.
8.
INPUT
:-
start
Initialize the segment address & clear the carry flag
Initialize the destination address
Load AX, BX, CX, DX values from respective memory locations
Add AX and CX register content and store the result in AX
ADD with carry BX and DX register content and store the result in BX
Store the results into memory from registers AX and BX
End of program
4100 : 11 11 22 22
4104 : 33 33 44 44
OUTPUT:- 4108 : 44 44 66 66
RESULT: Thus the addition of two 32-bit numbers has been executed successfully using 8086
microprocessor and the result is verified
22
Start
Stop
23
PROG 6 (A)
AIM:
To perform the subtraction of two 8 bit numbers using 8086
APPARATUS:
ALS-86 p kit.
Key board
Power supply
ALGORITHM:
1.
2.
3.
4.
5.
6.
7.
8.
INPUT
:-
start
Initialize the segment address & clear the carry flag
Initialize the destination address
Move the first 8-bit number to AL register
Move the second 8-bit number to BL register
Subtract the contents of AL and BL and store result in AL
Store the result into memory from registers
End of program
4100 : 45
4101 : 55
OUTPUT:- 4102 : F0
RESULT: Thus the Subtraction of two 8-bit numbers has been executed successfully using
8086 MP and the result is verified.
24
PROG 6 (B)
AIM:
To perform the subtraction of two 16- bit numbers using 8086
APPARATUS:
ALS-86 p kit.
Key board
Power supply
ALGORITHM:
1.
2.
3.
4.
5.
6.
7.
8.
INPUT
:-
start
Initialize the segment address & clear the carry flag
Initialize the destination address
Move the first 16-bit number to AX register
Move the second 16-bit number to BX register
Subtract the contents of AX and BX and store result in AX
Store the result into memory from registers
End of program
4100 : 4433
4102 : 2211
RESULT: Thus the Subtraction of two 16 -bit numbers has been executed successfully using
8086 MP and the result is verified
25
Start
Stop
26
PROG 7 (A)
AIM:
To perform the multiplication of two 8- bit numbers using 8086
APPARATUS:
ALS-86 p kit.
Key board
Power supply
ALGORITHM:
1.
2.
3.
4.
5.
6.
7.
INPUT
:-
start
Initialize the segment address
Initialize the destination address
Read two numbers into registers from memory
Multiply the two numbers & store the result in another register
Store the result into memory from registers
End of program
4100 : 33
4101 : 22
RESULT: Thus the multiplication of two 8 -bit numbers has been executed successfully using
8086 MP and the result is verified
27
PROG 7(B)
AIM:
To perform the multiplication of two 16- bit numbers or word using 8086
microprocessor
APPARATUS:
ALS-86 p kit.
Key board
Power supply
ALGORITHM:
1.
2.
3.
4.
5.
6.
INPUT
:-
4100 : 3333
4102 : 2222
RESULT: Thus the multiplication of two 8 -bit numbers has been executed successfully using
8086 MP and the result is verified
28
Start
Stop
29
PROG 8(A)
AIM:
To perform the division of 16 bit by 8 bit number using 8086 microprocessor
APPARATUS:
ALS-86 p kit.
Key board
Power supply
ALGORITHM:
1.
2.
3.
4.
5.
6.
7.
INPUT
:-
start
Initialize the segment address
Initialize the destination address
Load two numbers from memory to registers
Divide the two numbers &store the result in a register
Store the result into memory from registers
End of program
4100 : 2489
4102 : 0002
OUTPUT:-
4103 : 1244
4105 : 0001
RESULT: Thus the division of 16-bit number by 8 bit number has been executed successfully
using 8086 MP and the result is verified
30
PROG 8(B)
AIM:
To perform the division of 32- bit number by 16 Bit number using 8086
microprocessor
APPARATUS:
ALS-86 p kit.
Key board
Power supply
ALGORITHM:
1.
2.
3.
4.
5.
6.
7.
INPUT
:-
OUTPUT:-
start
Initialize the segment address
Initialize the destination address
Load two numbers from memory to registers
Divide the two numbers &store the result in a register
Store the result into memory from registers
End of program
4100 : 2849
4102 : 0000
4104 : 0002
AX : 1244
DX : 0001
RESULT: Thus the division of 32-bit number by 16- bit number has been executed successfully
using 8086 MP and the result is verified
31
START
Initialize CL with 05
Initialize AL with 00
Add AL and CL
Decrement CL
CL = 0
STOP
32
PROG 9(A)
AIM:
To perform the sum of given numbers(1,2,3,4,and 5) using 8086 microprocessor
APPARATUS:
ALS-86 p kit.
Key board
Power supply
ALGORITHM:
1.
2.
3.
4.
5.
start
Initialize the CL register with 05
Initialize the register A to 00
Add register contents of A and C
Decrement the count value if count is not equal to zero jump to
Loop1(L1)
6. Repeat step 5 up to count becomes 0
7. End of program
INPUT
:5+4+3+2+1
OUTPUT:-
AL: 0F
RESULT: Thus the sum of given N numbers(1,2,3,4,and 5) has been executed successfully
using 8086 MP and the result is verified
33
Initialize CL with 05
Load BL with CL
Initialize AL with 00
Add AL and CL
CL = 0
AL = AX/BL
STOP
34
PROG 9(B)
AIM:
To perform the average of given numbers(1,2,3,4,and 5) using 8086 microprocessor
APPARATUS:
ALS-86 p kit.
Key board
Power supply
ALGORITHM:
1.
2.
3.
4.
5.
start
Initialize the CL and BL register with 05
Initialize the register A to 00
Add register contents of A and C
Decrement the count value if count is not equal to zero jump to
Loop1(L1)
6. Repeat step 5 up to count becomes 0
7. Divide the content of A with 05.
8. End of program
INPUT
:(5+4+3+2+1) / 05
OUTPUT:-
AL: 03
RESULT: Thus the average of given N numbers(1,2,3,4,and 5) has been executed successfully
using 8086 MP and the result is verified
35
START
Initialize CL with 05
Initialize BL with 00
Load AL with CL
Add AL and BL
Decrement CL
No
CL = 0
Yes
STOP
36
PROG 9(C)
AIM:
To perform the sum of squares of N numbers (1,2,3,4,and 5) using 8086
microprocessor
APPARATUS:
ALS-86 p kit.
Key board
Power supply
ALGORITHM:
1.
2.
3.
4.
5.
6.
start
Initialize the CL and load the same into AL
Initialize the register BL to 00
Multiply CL with AL
Add AL and BL store result in BL
Decrement the count value if count is not equal to zero jump to
Loop1(L1)
7. Repeat step 6 up to count becomes 0
8. End of program
INPUT
:-
OUTPUT:-
52+42+32+22+1
25+16+9+4+1
AL: 37(Hex) 55(Dec)
RESULT: Thus the sum of squares of given N numbers(1,2,3,4,and 5) has been executed
successfully using 8086 MP and the result is verified
37
PROG 10(A)
AIM:
To perform a program to sort given 8 number in descending order starting from address
4100
APPARATUS:
ALS-86 p kit.
Key board
Power supply
ALGORITHM:
1. start
2. Initialize the segment address
3. Initialize the destination address
4. Counter initializes to 8
5. BX to point input stream
6. Get the byte AL
7. Increment the pointer
8. Compare AL with next byte
9. If AL>=[BL] jump out
10. Else exchange
11. Adjacent byte
12. If exchange is mode flag it
13. Loop till the end
14. Now see if a pass is exchange free
End of program
38
INPUT
:4100 :
4101 :
4102 :
4103 :
4104 :
4105 :
4106 :
4107 :
02
04
06
03
01
05
08
07
4100 :
4101 :
4102 :
4103 :
4104 :
4105 :
4106 :
4107 :
08
07
06
05
04
03
02
0
OUTPUT:-
RESULT:
By using 8086 microprocessor trainer the given 8 bytes of data is sorted in the
descending order
39
PROG10 (B)
AIM:
To perform a program to sort given 8 number in ascending order starting from address
4100
APPARATUS:
ALS-86 p kit.
Key board
Power supply
ALGORITHM:
1.
2.
3.
4.
5.
6.
7.
8.
9.
INPUT
start
Initialize the segment address
Initialize the destination address
Get the data byte into AL
Get the 10 digit to lower
Nibble of AL, most with units
Multiply by 10s digit by 10
Add unit to it
End of program
:4100 :
4101 :
4102 :
4103 :
4104 :
4105 :
4106 :
4107 :
02
04
06
03
01
05
08
07
4100 :
4101 :
4102 :
4103 :
4104 :
4105 :
4106 :
4107 :
01
02
03
04
05
06
07
08
OUTPUT:-
RESULT:
By using 8086 microprocessor trainer the given 8 bytes of data is sorted in the
ascending order
40
PROG 11(A)
AIM:
41
INPUT
:-
RESULT:
Thus conversion of Hex number to decimal number performed by 8086 MP
42
PROG 11 (B)
AIM:
Program to convert given decimal number to hexa decimal number
APPARATUS:
ALS-86 p kit.
Key board
Power supply
ALGORITHM:
10. start
11. Initialize the segment address
12. Initialize the destination address
13. Get the data byte into AL
14. Get the 10 digit to lower
15. Nibble of AL, most with units
16. Multiply by 10s digit by 10
17. Add unit to it
18. End of program
INPUT
:-
OUTPUT:-
RESULT:
Thus conversion of decimal number to Hex number performed by 8086 microprocessor
43
PROG 12
AIM:
Program to compute the logical 1s in a wordusing 8086 assembly language
APPARATUS:
ALS-86 p kit.
Key board
Power supply
ALGORITHM:
1. start
2. Initialize the segment address
3. Initialize the destination address
4. Get the data words to AX
5. Initializes count location to 0
6. Set counter to 16
7. Shift AX to check last bit
8. If it not 1 jump out and if it is 1 increment counter
9. Repeat for all 16 bits
10. End of the program
Input : 4100 : 32 00
Output : 4102 : 03
RESULT:
Thus number of ones are counted in a given word using 8086 microprocessor program
44
PROG 13
AIM:
8086 Kit
program
APPARATUS:
ALS-86 p kit.
Key board
Power supply
ALGORITHM:
1.
2.
3.
4.
5.
6.
7.
8.
9.
start
Get the AL value from 4100 memory location load the same in AH.
Mask with higher nibble
Call convert to ASCII routine
Load AL from AH and initialize the counter with 4
Rotate AL for 4 times(getting higher nibble)
Mask with higher nibble
Call convert to ASCII routine
End of the program
Input : 4100 : 3A
Output : AL : 33 AH : 41
RESULT:
The given binary number is converted into ASCII value using 8086 microprocessor.
45
PROG 1A
AIM: To write an assembly language program to perform addition of two 8-bit signed and unsigned numbers
RESOURCES REQUIERED:
Personal Computer
MASM/TASM Software Installed
ADDRESS
0000
0001
VALUES1
12
56
VALUES2
FE
03
---------------------------
--------------------------
X+Y
X+Y
Result :
Thus the program for addition of two bytes has been executed successfully by using MASM &
result is verified
46
PROG 1B
MASM
AIM: To write an assembly language program to perform subtraction of two 8-bit signed and unsigned
numbers
RESOURCES REQUIERED:
Personal Computer
MASM/TASM Software Installed
CF=0
Result :
Thus the program for addition of two bytes has been executed successfully by using masm & result
is verified
47
PROG 2A
AIM: To write an assembly language program to perform addition of two 16-bit signed and
unsigned numbers
RESOURCES REQUIERED:
Personal Computer
MASM/TASM Software Installed
FLAGS which may affect: AF, CF, OF, PF, SF, ZF
CALCULATIONS:
SYMBOL ADDRESS VALUES1 VALUES2
X
0000
1234
FDFE
Y
0002
5678
1234
RES
0004
X = 1234H 0001 0010 0011 0100
Y = 5678H 0101 0110 0111 1000
---------------------------------------------
Result :
Thus the program for addition of two words has been executed successfully by using MASM & result is
verified
48
PROG 2B
AIM: To write an assembly language program to perform subtraction of two 16-bit signed and
unsigned numbers
RESOURCES REQUIERED:
Personal Computer
MASM/TASM Software Installed
X=
Y=
3322 11001100100010
2211 10001000010001
---------------------------X+Y= 1111 1000100010001
Result
Thus the program for subtraction of two words has been executed successfully by using
MASM & result is verified.
49
PROG 3A
MASM
AIM: To write an assembly language program to perform multiplication of two 8-bit unsigned
numbers
RESOURCES REQUIERED:
Personal Computer
MASM/TASM Software Installed
Result
Thus the program for multiplication of two 8-bit program executed successfully by using TASM &
result is verified.
50
PROG 3B
MASM
AIM: To write an assembly language program to perform multiplication of two 16-bit unsigned
numbers
RESOURCES REQUIERED:
Personal Computer
MASM/TASM Software Installed
Result :
Thus the program for multiplication of two 16-bit program executed successfully by using TASM
& result is verified.
51
PROG 4A
MASM
AIM: To write an assembly language program to perform division of 16-bit unsigned number by
8-bit unsigned number
RESOURCES REQUIERED:
Personal Computer
MASM/TASM Software Installed
FLAGS AFFECTED: IF
CALCULATIONS:
SYMBOL ADDRESS VALUES1 VALUES2
X
0000
014D
1200
Y
0002
34
55
Q
0003
R
0004
Result:
Thus the 16 bit by 8 bit division of program executed successfully by using MASM & result is
verified.
52
PROG 4B
MASM
AIM: To write an assembly language program to perform division of 32-bit unsigned number by
16-bit unsigned number.
RESOURCES REQUIERED:
Personal Computer
MASM/TASM Software Installed
FLAGS AFFECTED: IF
CALCULATIONS:
SYMBOL ADDRESS VALUES1 VALUES2
DLW
0000
0032
0BCD
DHW
0002
02AB
00AB
Divisr
0004
2012
ABCD
Q
0006
R
0008
Result :
Thus the 32 bit by 16 bit division of program executed successfully by using MASM & result is
verified.
53
Signed Multiplication
PROG 5A
MASM
AIM: To write an assembly language program to perform multiplication of two 16-bit signed
numbers
RESOURCES REQUIERED:
Personal Computer
MASM/TASM Software Installed
CALCULATIONS:
SYMBOL ADDRESS VALUES1 VALUES2
X
0000
Y
0002
RESLW
0004
RESHW
0006
Case 1:Two Positive Numbers
X = 7593, Y = 6845
Case 2: one positive number & one negative number
X = 8A6D, Y = 6845
Case 3: two negative numbers
X = 8A6D, Y = 97BB
Result: thus the multiplication of two 16-bit signed numbers performed using MASM & results
verified
54
Signed Division
PROG 5B
MASM
AIM: To write an assembly language program to perform Division of 16-bit signed number by 8Bit Signed Number
RESOURCES REQUIERED:
Personal Computer
MASM/TASM Software Installed
FLAGS AFFECTED: IF
CALCULATIONS:
SYMBOL ADDRESS VALUES1 VALUES2
X
0000
Y
0002
Q
0003
R
0004
Case 1:Two Positive Numbers
X = 26F8, Y = 56
Case 2: one negative number & one positive number
X = D908, Y = 56
Case 3: one positive number & one negative number X = 26F8, Y = AA
Result: Thus the division 16-bit by 8-bit signed numbers are performed using MASM & results
verified
55
ASCII ADDITION
PROG 6A
MASM
CALCULATIONS:
SYMBOL ADDRESS VALUES1 VALUES2
CHAR1
0000
35h
CHAR2
0001
37h
RES(AX)
0002
0102h
RES = 0102 (AX) unpacked BCD of 12
Result :
Thus the program for AAA has been executed successfully by using MASM & result is verified.
56
ASCII SUBTRACTION
PROG 6B
MASM
CALCULATIONS:
SYMBOL ADDRESS VALUES1 VALUES2
CHAR1
0000
37h
CHAR2
0001
35h
RES
0002
02
0003
00
37 35 = 02
RES= 0002H
Result
Thus the program for AAS has been executed successfully by using MASM & result is
verified.
57
ASCII MULTIPLICATION
PROG 6C
MASM
CALCULATIONS:
SYMBOL ADDRESS VALUES1 VALUES2
NUM1
0000
09
NUM2
0001
05
RES
0002
05
0003
04
09 * 05 =
RES = 0405 (AX) unpacked BCD of 45
Result:
Thus the program for AAM has been executed successfully by using MASM & result is verified
58
ASCII DIVISION
PROG 6D
MASM
CALCULATIONS:
SYMBOL ADDRESS VALUES1 VALUES2
DIVIDEND
0000
0607
DIVISOR
0002
09
RESQ
0003
07
RESR
0004
04
INPUT:DIVIDEND = 0607H unpacked BCD of 67
DIVISOR = 09H
OUTPUT: RESQ = 07 (AL)
RESR = 04 (AH)
Result :
Thus the program for AAD has been executed successfully by using TASM & result is
verified.
59
PROG 7
MASM
AIM: To write an assembly language program to perform PACKED BCD into UNPACKED BCD
conversion.
RESOURCES REQUIERED:
Personal Computer
MASM/TASM Software Installed
FLAGS AFFECTED: PF
CALCULATIONS:
SYMBOL ADDRESS VALUES1 VALUES2
BCD
0000
49
UBCD1
0002
UBCD2
0003
INPUT:
OUTPUT:
BCD = 49
UBCD1 = 09
UBCD2 = 04
Result :
Thus packed BCD converted into unpacked BCD using MASM & results verified
60
PROG 8
MASM
FLAGS AFFECTED: PF
CALCULATIONS:
SYMBOL ADDRESS VALUES1 VALUES2
BCD
0000
49
ASCII1
0002
ASCII2
0003
INPUT:
BCD = 49
OUTPUT: ASCII1= 39
ASCII2= 34
Result :
Thus the given BCD number converted into ASCII using MASM & results verified.
61
PROG 9A
MASM
AIM: To write an assembly language program to perform DECIMAL adjust after addition of two
8-bit signed and unsigned numbers
RESOURCES REQUIERED:
Personal Computer
MASM/TASM Software Installed
Program:
Result :
Thus the program for DAA has been executed successfully by using MASM & result is
verified.
62
PROG 9B
MASM
AIM: To write an assembly language program to perform DECIMAL adjust after subtraction of
two 8-bit signed and unsigned numbers
RESOURCES REQUIERED:
Personal Computer
MASM/TASM Software Installed
Program:
Result :
Thus the program for DAS has been executed successfully by using MASM & result is
verified.
63
BLOCK MOVE
PROG 10 A
MASM
AIM: To write an assembly language program to move the block of data from a specified source
location to the specified destination location.
RESOURCES REQUIERED:
Personal Computer
MASM/TASM Software Installed
REGISTERS USED: AX, DS, ES, SI, DI
FLAGS AFFECTED: No flags are affected
RESULT:
INPUT:
STR (DS:2000H) = 04H,F9H,BCH,98H,40H
OUTPUT:
STR1(ES:3000H) = 04H,F9H,BCH,98H,40H
Results:
Thus the block of data moved from a specified source location to the specified destination location
using MASM 7 results verified.
64
PROG 10 B
MASM
OUTPUT:
Result :
Thus the given string is reversed using MASM & results verified.
65
PROG 10 C
MASM
AIM: To write an assembly language program to find the length of the given string.
RESOURCES REQUIERED:
Personal Computer
MASM/TASM Software Installed
REGISTERS USED: AX,DS,SI,CL
FLAGS AFFECTED: ZF,PF,SF,AF,CF
RESULT:
INPUT:
STR (DS:0000H) =
01H, #03H,08H,09H,05H,07H,#02H
OUTPUT:
Result :
Thus the length of the given string is identified using MASM software & results are verfified.
66
PROG 10 D
STRING COMPARISION
MASM
SRC (DS:0000H) =
04H,05H,07H,08H
DST (ES:0000H) =
04H,06H,07H,09H
OUTPUT:
I): IF SRC = DST THEN ZF = 1 &
II): IF SRC DST THEN ZF = 0
Result :
The given two strings are compared using MASM software and results are verified.
67
PROG 10 E
STRING INSERTION
MASM
AIM: To write an Assembly Language Program for inserting one string into the other.
RESOURCES REQUIERED:
Personal Computer
MASM/TASM Software Installed
FLAGS AFFECTED: No flags are affected
OUTPUT: new string
Result:
Thus sting insertion program executed sucessfully using MASM software and results are verfied.
68
PROG 10 F
STRING DELETION
MASM
AIM: To write an Assembly Language Program for deleting a string in specified index range
RESOURCES REQUIERED:
Personal Computer
MASM/TASM Software Installed
Results :
thus the string deletion program executed successfully using MASM software and results
verified.
69
PROG 10 G
MASM
Result:
Thus the program to display the given string executed successfully using MASM & results
verified.
70
PROG 1
8086
Interfacing
AIM: To write an assembly language program to generate a Positive ramp signal using 8086
microprocessor.
RESOURCES REQUIERED: 8086 Microprocessor trainer kit,
Dual DAC kit,
CRO.
71
PROG 2
8086
Interfacing
AIM: To write an assembly language program to generate a negative ramp signal using 8086
trainer kit.
RESOURCES REQUIERED: 8086 Microprocessor trainer kit,
Dual DAC kit,
CRO.
72
PROG 3
8086
Interfacing
AIM: To write an assembly language program to generate a Square wave using 8086 trainer kit.
RESOURCES REQUIERED: 8086 Microprocessor trainer kit,
Dual DAC kit,
CRO.
73
PROG 4
8086
Interfacing
AIM: To write an assembly language program to generate a triangular wave using 8086 trainer kit.
RESOURCES REQUIERED: 8086 Microprocessor trainer kit,
Dual DAC kit,
CRO.
.
74
PROG 5
8086
Interfacing
AIM: To write an assembly language program to generate a sine wave using 8086 trainer kit.
RESOURCES REQUIERED: 8086 Microprocessor trainer kit,
Dual DAC kit,
CRO.
FORMULA USED
128+128 SIN X Where X=0 T0 360 with Step 5
LOOK UP TABLE
4000
4001
4002
4003
4004
4005
4006
4007
4008
4009
400A
400B
400C
400D
400E
400F
4010
4011
4012
4026
4027
4028
4029
402A
402B
402C
402D
402E
402F
4030
4031
4032
4033
4034
4035
4036
4037
80
8B
96
A1
AB
B6
C0
C9
D2
DA
E2
E8
EF
F4
F8
FB
FE
FF
FF
74
6A
5F
54
4A
40
36
2E
25
1E
17
11
0C
08
04
02
00
00
4013
4014
4015
4016
4017
4018
4019
401A
401B
401C
401D
401E
401F
4020
4021
4022
4023
4024
4025
4038
4039
403A
403B
403C
403D
403E
403F
4040
4041
4042
4043
4044
4045
4046
4047
4048
4049
FF
FF
FE
FB
F8
F4
EF
E8
E2
DA
D2
C9
C0
B6
AB
A1
96
8B
80
00
02
04
08
0C
11
17
1E
25
2E
36
40
4A
54
5F
6A
74
80
76
PROG 6
8086
Interfacing
AIM: To Interface Stepper Motor to 8086 using 8255 and write Assembly Language Program to
rotate Stepper Motor in Anticlockwise direction in full stepping.
RESOURCES REQUIRED: 8086 trainer kit,
8225 microprocessor Interface,
Stepper Motor,
Power Supply.
RESULT: Stepper motor is interfaced with 8086 using 8255 and operation is verified.
77
PROG 7
8086
Interfacing
78
79
PROG 1
8051
Microcontrollers
AIM:
To write an assembly language program to perform the operations like reading and writing
the data on a parallel port of 8051 microcontroller.
RESOURCES REQUIRED: 8051 Micro Controller kit.
Key Board
Adapter.
RESULT: Thus the operations like reading and writing the data on a parallel port performed using
8051 microcontroller.
80
PROG 2
8051 TIMERS
8051
Microcontrollers
81
PROG 3
8051
Microcontrollers
AIM: To write an assembly language program to perform the BIT and BYTE operations like set,
reset and swap by using 8051 microcontroller.
RESOURCES REQUIERED: 8051 microcontroller kit
Keyboard
Power supply
82
PROG 4
8051
Microcontrollers
PROG 5
2S COMPLIMENT
8051
Microcontrollers
PROG 6
8-BIT SUBTRACTION
8051
Microcontrollers
AIM: To perform subtraction of two 8-bit numbers stored at some location. Store the result in next
location and in next location store 00H or 01H for positive and negative numbers respectively
RESOURCES REQUIERED: 8051 microcontroller kit
Keyboard
Power supply
RESULT:
8-bit subtraction is done by 8051 kit
85
PROG 7
8-BIT DIVISION
8051
Microcontrollers
AIM: To perform the division operation of two 8-bit numbers using 8051 microcontroller
RESOURCES REQUIERED: 8051 microcontroller kit
Keyboard
Power supply
RESULT: Division of two 8-bit numbers is done by using 8051 microcontroller kit
86
PROG 8
8051
Microcontrollers
AIM: To convert a Binary number into a BCD number using 8051 micro controller
87
PROG 9
SUM 0F N-NUMBER
8051
Microcontrollers
RESULT:
Sum of first four natural numbers is done with 8051 kit.
88
PROG 10
SMALLEST NUMBER
8051
Microcontrollers
AIM: To perform an operation of finding smallest number among given data by using 8051 micro
controller
RESOURCES REQUIERED: 8051 microcontroller kit
Keyboard
Power supply
RESULT: Among the given data smallest number found using 8051 kit
89
PROG 11
BIGGEST NUMBER
8051
Microcontrollers
AIM: To perform an operation of finding biggest number among given data by using 8051 micro
controller
RESOURCES REQUIERED: 8051 microcontroller kit
Keyboard
Power supply
RESULT: Among the given data biggest number found using 8051 kit
90
PROG 12
8051
Microcontrollers
AIM: To convert BCD number into ASCII by using 8051 micro controller
RESOURCES REQUIERED: 8051 microcontroller kit
Keyboard
Power supply
RESULT:
The given number is converted into ASCII using 8051 microcontroller kit.
91
PROG 13
GENERATION OF 00 TO 0F NUMBERS
8051
Microcontrollers
AIM: To generate a series of numbers from 00h to 0Fh by using 8051 micro controller
RESOURCES REQUIERED: 8051 microcontroller kit
Keyboard
Power supply
DSP PROCESSORS
EXP :1
Theory:
A signal can be defined as a function that conveys information, generally about the state
or behavior of a physical system. There are two basic types of signals viz Analog (continuous
time signals which are defined along a continuum of times) and Digital (discrete-time).
Remarkably, under reasonable constraints, a continuous time signal can be adequately
represented by samples, obtaining discrete time signals. Thus digital signal processing is an
ideal choice for anyone who needs the performance advantage of digital manipulation along
with todays analog reality.
Hence a processor which is designed to perform the special operations(digital
manipulations) on the digital signal within very less time can be called as a Digital signal
processor. The difference between a DSP processor, conventional microprocessor and a
microcontroller are listed below.
Microprocessor or General Purpose Processor such as Intel xx86 or Motorola 680xx family
Contains - only CPU
-No RAM
-No ROM
-No I/O ports
-No Timer
Some Micro Controllers also contain A/D, D/A and Flash Memory
93
94
Bus Structure
-bit buses (four program/data buses
and four address buses):
_ The program bus (PB) carries the instruction code and immediate operands from program
memory.
_ Three data buses (CB, DB, and EB) interconnect to various elements, such as the CPU, data
address generation logic, program address generation logic, on-chip peripherals, and data
memory.
_ The CB and DB carry the operands that are read from data memory.
_ The EB carries the data to be written to memory.
_ Four address buses (PAB, CAB, DAB, and EAB) carry the addresses needed for instruction
execution.
The C67xx DSP can generate up to two data-memory addresses per cycle using the two
auxiliary register arithmetic units (ARAU0 and ARAU1). The PB can carry data operands
stored in program space (for instance, a coefficient table) to the multiplier and adder for
95
The ALU can also function as two 16-bit ALUs and perform two 16-bit operations
simultaneously.
96
Instructions are provided for storing the guard bits, for storing the high- and the low-order
accumulator words in data memory, and for transferring 32-bit accumulator words in or out of
data memory. Also, either of the accumulators can be used as temporary storage for the other.
Barrel Shifter
The C67x DSP barrel shifter has a 40-bit input connected to the accumulators or to data memory
(using CB or DB), and a 40-bit output connected to the ALU or to data memory (using EB). The
barrel shifter can produce a left shift of 0 to 31 bits and a right shift of 0 to 16 bits on the input
data. The shift requirements are defined in the shift count field of the instruction, the shift count
field (ASM) of status register ST1, or in temporary register T (when it is designated as a shift
count register).The barrel shifter and the exponent encoder normalize the values in an
accumulator in a single cycle. The LSBs of the output are filled with 0s, and the MSBs can be
either zero filled or sign extended, depending on the state of the sign-extension mode bit (SXM)
in ST1. Additional shift capabilities enable the processor to perform numerical scaling, bit
extraction, extended arithmetic, and overflow prevention operations.
Multiplier/Adder Unit
The multiplier/adder unit performs 17 _ 17-bit 2s-complement multiplication with a 40-bit
addition in a single instruction cycle. The multiplier/adder block consists of several elements: a
multiplier, an adder, signed/unsigned input control logic, fractional control logic, a zero
detector, a rounder (2s complement), overflow/saturation logic, and a 16-bit temporary storage
register (T). The multiplier has two inputs: one input is selected from T, a data-memory
operand, or accumulator A; the other is selected from program memory, data memory,
accumulator A, or an immediate value. The fast, on-chip multiplier allows the C54x DSP to
perform operations efficiently such as convolution, correlation, and filtering. In addition, the
multiplier and ALU together execute multiply/accumulate (MAC) computations and ALU
operations in parallel in a single instruction cycle. This function is used in determining the
Euclidian distance and in implementing symmetrical and LMS filters, which are required for
complex DSP algorithms.
97
98
EXP :2
THEORY
Convolution is a formal mathematical operation, just as
multiplication, addition, and integration. Addition takes two numbers and
produces a third number, while convolution takes two signals and produces a
third signal. Convolution is used in the mathematics of many fields, such as
probability and statistics. In linear systems, convolution is used to
describe the relationship between three signals of interest: the input
signal, the impulse response, and the output signal.
In this equation, x1(k), x2 (n-k) and y(n) represent the input to and output
from the system at time n. Here we could see that one of the input is shifted
in time by a value everytime it is multiplied with the other input signal.
Linear Convolution is quite often used as a method of implementing filters of
various types.
PROCEDURE:
1. Open Code Composer Studio and make sure DSP kit is Switched ON
2. Start a new Project using new project from project menu icon
and save it.
3. Write a program for generating sinewave in c language and save
it with .c extension.
4. Add runtime support library file rts6700.lib to the library
icon of the project
5. Add linear command file Hello.cmd to the source icon of the
project.
6. Compile the program using icon in task bar and make corrections
if any errors occur.
7. Build in and Build on the project; using icons in the task bar.
8. Go to debug and double click on connect option.
9. Go to the file and click on load program and then open the file
we find extension .out project file.
10. Go to debug and run the program.
11. To view graphically, select view graph time/frequency.
99
ALGORITHM
Step 1 Declare three buffers namely Input buffer, Temporary Buffer, Output Buffer.
Step 2 Get the input from the CODEC, store it in Input buffer and transfer it to the first location
of the Temporary buffer.
Step 3 Make the Temporary buffer to point to the last location.
Step 4 Multiply the temporary buffer with the coefficients in the data memory and accumulate it
with the previous output.
Step 5 Store the output in the output buffer.
Step 6 Repeat the steps from 2 to 5.
Result:
enter value for m4
enter value for n4
Enter values for i/p
1234
Enter Values for n
1234
The Value of output y[0]=1
The Value of output y[1]=4
The Value of output y[2]=10
The Value of output y[3]=20
The Value of output y[4]=25
The Value of output y[5]=24
The Value of output y[6]=16
Result:
Hence Linear Convolution of the one-dimensional signal is determined by
writing c program and using DSP Kit.
100
EXP :3
THEORY
Circular convolution is another way of finding the convolution sum
of two input signals. It resembles the linear convolution, except that
the sample values of one of the input signals is folded and right
shifted before the convolution sum is found. Also note that circular
convolution could also be found by taking the DFT of the two input
signals and finding the product of the two frequency domain signals.
The Inverse DFT of the product would give the output of the signal in
the time domain which is the circular convolution output. The two input
signals could have been of varying sample lengths. But we take the DFT
of higher point, which ever signals levels to. For eg. If one of the
signal is of length 256 and the other spans 51 samples, then we could
only take 256 point DFT. So the output of IDFT would be containing 256
samples instead of 306 samples, which follows N1+N2 1 where N1 & N2
are the lengths 256 and 51 respectively of the two inputs. Thus the
output which should have been 306 samples long is fitted into 256
samples. The 256 points end up being a distorted version of the correct
signal. This process is called circular convolution.
PROCEDURE:
1. Open Code Composer Studio and make sure DSP kit is Switched ON
2. Start a new Project using new project from project menu icon
and save it.
3. Write a program for generating sinewave in c language and save
it with .c extension.
4. Add runtime support library file rts6700.lib to the library
icon of the project
5. Add linear command file Hello.cmd to the source icon of the
project.
6. Compile the program using icon in task bar and make corrections
if any errors occur.
7. Build in and Build on the project; using icons in the task bar.
8. Go to debug and double click on connect option.
9. Go to the file and click on load program and then open the file
we find extension .out project file.
10. Go to debug and run the program.
11. To view graphically, select view graph time/frequency.
101
122
106
102
EXP :4
FFT USING C
X ( k ) x ( n) e
j 2
nk
n
;0 k N 1
k 0
The above equation is the mathematical representation of the DFT. As
the number of computations involved in transforming a N point time
domain signal into its corresponding frequency domain signal was found
to be N2 complex multiplications, an alternative algorithm involving
lesser number of computations is opted.
When the sequence x(n) is divided into 2 sequences and the DFT
performed separately, the resulting number of computations would be
N2/2
(i.e.)
N2
21
N2
21
n 0
n 0
Consider x(2n) be the even sample sequences and x(2n+1) be the odd
sample sequence derived form x(n).
N2
21
x ( 2n)
WN2 nk
n 0
would result
N2
21
(N/2)2multiplications
x(2n 1)
n 0
WN( 2 n1) k
103
N2
N2
N2
Computations
4
4
2
N
21
x ( k ) x ( 2n) W
x(2n 1) W
2 nk
N
n 0
N
21
x ( 2 n) W
W
N
(9)
N
21
2 nk
N
n 0
n 0
( 2 nk )
N
n 0
Dividing the sequence x (2n) into further 2 odd and even sequences would reduce the
computations.
WN is the twiddle factor
j 2
n
nk
N
j 2
K
2
j 2
k
n
k
N
nk
K
2
WN W
e
(11)
j 2 n
n
2
j 2
k
n
104
K
2
WNk (1)
K
2
WNk
(12)
N
21
n 0
n 0
K
N
2 nk
x(k ) x(2n) WN W x(2n 1) 21 WN( 2 nk ) (14)
2
n 0
N
The time burden created by this large number of computations limits the usefulness of DFT
in many applications. Tremendous efforts devoted to develop more efficient ways of
computing DFT resulted in the above explained Fast Fourier Transform algorithm. This
mathematical shortcut reduces the number of calculations the DFT requires drastically. The
above mentioned radix-2 decimation in time FFT is employed for domain transformation.
Dividing the DFT into smaller DFTs is the basis of the FFT. A radix-2 FFT divides the DFT
into two smaller DFTs, each of which is divided into smaller DFTs and so on, resulting in a
combination of two-point DFTs. The Decimation -In-Time (DIT) FFT divides the input
(time) sequence into two groups, one of even samples and the other of odd samples. N/2
point DFT are performed on the these sub-sequences and their outputs are combined to form
the N point DFT.
FIG. 3A.1
The above shown mathematical representation forms the basis of N point FFT and is called the
Butterfly Structure.
105
STAGE I
STAGE - II
106
STAGE III
FIG. 3A.2 8 POINT DIT
ALGORITHM
Step 1
sample the input (N) of any desired frequency. Convert it to fixed-point format
and scale the input to avoid overflow during manipulation.
Step 2 Declare four buffers namely real input, real exponent, imaginary exponent and
imaginary input.
Step 3 Declare three counters for stage, group and butterfly.
Step 4 Implement the Fast Fourier Transform for the input signal.
Step 5 Store the output (Real and Imaginary) in the output buffer.
Step 6 Decrement the counter of butterfly. Repeat from the Step 4 until the counter
reaches zero.
Step 7 If the butterfly counter is zero, modify the exponent value.
Step 8 Repeat from the Step 4 until the group counter reaches zero.
Step 9 If the group counter is zero, multiply the butterfly value by two and divide the
group value by two.
Step 10 Repeat from the Step 4 until the stage counter reaches zero.
Step 11 Transmit the FFT output through line out port.
107
PROCEDURE:
1. Open Code Composer Studio and make sure DSP kit is Switched ON
2. Start a new Project using new project from project menu icon
and save it.
3. Write a program for generating sinewave in c language and save
it with .c extension.
4. Add runtime support library file rts6700.lib to the library
icon of the project
5. Add linear command file Hello.cmd to the source icon of the
project.
6. Compile the program using icon in task bar and make corrections
if any errors occur.
7. Build in and Build on the project; using icons in the task bar.
8. Go to debug and double click on connect option.
9. Go to the file and click on load program and then open the file
we find extension .out project file.
10. Go to debug and run the program.
11. To view graphically, select view graph time/frequency.
OUTPUT:
by writing c
108
EXP :05(A)
RESULT:
Matlab program for finding the frequency response of analog LPF using
ellip type is written.
Waveforms:
109
EXP :05(A)
RESULT:
Matlab program for finding the frequency response of analog LPF using
ellip type is written.
Waveforms:
110
EXP :05(B)
RESULT:
Matlab program for finding the frequency response of analog HPF
using Butterworth type is written.
Waveforms:
111
EXP :5(c)
RESULT:
Matlab program for finding the frequency response of analog BPF using
cheby-1 type is written.
Waveforms:
112
EXP :05(D)
RESULT:
Matlab program for finding the frequency response of analog BSF
using cheby-2 type is written.
Waveforms:
113
EXP :6
RESULT:
By using matlab programme, power density spectrum is found.
Waveforms:
Absolute value of FFT of Zdouble & Zsingle Vs Frequency:
114
115
Windows XP
- Simulator
- CCStudio 3 & MATLAB 7.5
THEORY:
A Finite Impulse Response (FIR) filter is a discrete linear time-invariant system
whose output is based on the weighted summation of a finite number of past inputs.
The coefficients are generated by using FDS (Filter Design Software or Digital filter design package).
FIR filter is a finite impulse response filter. Order of the filter should be specified.
Infinite response is truncated to get finite impulse response. placing a window of
finite length does this. Types of windows available are Rectangular, Barlett,
Hamming, Hanning, Blackmann window etc. This FIR filter is an all zero filter.
116
RESULTS:
117
RESULTS:
118
Windows XP
- Simulator
- CCStudio 3 & MATLAB 7.5
THEORY:
The IIR filter can realize both the poles and zeroes of a system because it has a
rational transfer function, described by polynomials in z in both the numerator and
the denominator
These filter coefficients are generated using FDS
(Filter Design software or Digital Filter design package).
IIR filters can be expanded as infinite impulse response filters. In designing IIR
filters, cutoff frequencies of the filters should be mentioned. The order of the filter
can be estimated using butter worth polynomial. Thats why the filters are named as
butter worth filters. Filter coefficients can be found and the response can be plotted.
119
RESULTS:
120
RESULTS:
121
122