Beruflich Dokumente
Kultur Dokumente
A. LABORATORY OVERVIEW
Degree: BE Programme: CSE
Semester: 4 Academic Year: 2016-17
Microprocessors and
Laboratory Title: Laboratory Code: 15CSL48
Microcontroller Laboratory
L-T-P-S: 1-0-2-0 Duration of USE: 3 Hrs
Total Contact Hours: 42 Hrs USE Marks: 80
Credits: 2 IA Marks: 20
B. DESCRIPTION
1. PREREQUISITES:
• Microprocessors And ARM Processors(15CS44)
• Basic Electronics (15ELN15)
• Analog and Digital Electronics(15CS32)
• Computer programming laboratory (15CPL16)
• Programming in C and Data Structures (15PCDS13).
2. BASE COURSE:
• Microprocessors and Microcontrollers (15CS44)
3. COURSE OUTCOMES:
At the end of the course, the student will be able to;
1. Apply the programming techniques in designing simple assembly language programs for
solving simple problems by using instruction set of 8086 microprocessor / ARM.
2. Gain hands-on experience in doing experiments on 8086 microprocessor / ARM by using
assembler tool (TASM / MASM) in the laboratory and present the report.
3. Understand the hardware, software tradeoffs involved in the design and interface hardware
devices to x86/ARM family.
4. Assess processors for various kinds of applications.
4. RESOURSES REQUIRED:
• Intel microprocessor based computer with 256MB RAM and 40GB secondary storage
• TASM / MASM assembler
• Interfacing Kits
• 8255 PPI card with FRC connector
• 12V power supply.
COURSE LABORATORY MANUAL
5. RELEVANCE OF THE COURSE:
• Operating Systems (10CS53)
• System Software (10CS52)
• Computer Networks (10CS55)
• Advanced Computer Architecture (10CS74).
6. GENERAL INSTRUCTIONS:
Start Run… cmd
TASM COMMANDS:
C:\ tasm > edit filename.asm ; Write the program and save.
C:\ tasm > tasm filename.asm ; If any errors, correct the same.
C:\ tasm > tlink filename.obj
C:\ tasm > debug filename.exe ; debugger command prompt
C:\ tasm > afdebug filename.exe ; afdebug command prompt
C:\ tasm > iopm filename.exe portnumber ; For Interfacing kits
After the debugger command prompt the
following commands are used; a – assemble
d – dump (to view the contents of
the data memory) g – go (to
execute the entire program at a
time)
u – unassemble
t – trace (to execute the
program in single step) r –
register (to see the
contents of the register) q
– quit
? – to view all the options
After the afdebug command prompt the following commands are
used;
F1 – for single step
execution of the program G
– for the execution of entire
program at a time Quit – to
exit from the afdebug screen
Alt+Enter – to
maximize/minimize the
screen.
8086 PRACTICE PROGRAMS:
8086 assembly language program to add two numbers –
Illustration of MOV/ADD/ADC instructions.
.MODEL SMALL
.STACK 100
.DATA
ALP to add two numbers which are read from the keyboard.
.model small
.data
msg1 db 13,10,'Enter the first number (digit) from the keyboard:$' msg2
db 13,10,'Enter the second number (digit) from the keyboard:$' msg3 db
13,10,13,10,'The sum of the two entered numbers (digits) is:$'
num1 db ?
num2 db ?
sum db ?
.code
start: mov ax,@data
mov ds,ax ; Initializes the DS.
mov dx, offset msg1 ; Displays the message1.
mov ah, 09h
int 21h
mov ah, 01h ; Allows the user to enter
int 21h ; a key from the keyboard.
sub al,30h ; To get the number in decimal.
mov num1, al
mov dx, offset msg2 ; Displays the message2.
mov ah, 09h
int 21h
mov ah, 01h ; Allows the user to enter
int 21h ; a key from the keyboard.
sub al,30h ; To get the number in decimal.
mov num2, al
7. CONTENTS:
Expt Blooms
Title of the Experiments CO
No. Level
CO1,2,3,
1 Design and develop an assembly language program to search a key element “X” in a L3 4
list of ‘n’ 16-bit numbers. Adopt Binary search algorithm in your program
for searching.
CO1,2,3,
2 Design and develop an assembly program to sort a given set of ‘n’ 16-bit L3 4
numbers in ascending order. Adopt Bubble Sort algorithm to sort given
elements.
CO1,2,3,
3 Develop an assembly language program to reverse a given string and L3 4
verify whether it is a palindrome or not. Display the appropriate message.
CO1,2,3,
4 Develop an assembly language program to compute nCr using recursive L3 4
procedure. Assume that ‘n’ and ‘r’ are non-negative integers.
CO1,2,3,
5 Design and develop an assembly language program to read the current time and L3 4
Date from the system and display it in the standard format on the screen.
6 To write and simulate ARM assembly language programs for data L3 CO1,2,3,4
transfer, arithmetic and logical operations.
7 To write and simulate C Programs for ARM microprocessor in KEIL L3 CO1,2,3,4
8 a. Design and develop an assembly program to demonstrate BCD Up-Down L4 CO1,2,3,4
Counter on the Logic Controller Interface.
b. Design and develop an assembly program to read the status of two 8-bit
inputs (X & Y) from the Logic Controller Interface and display X*Y.
9 Design and develop an assembly program to display messages “FIRE” and L3 CO1,2,3,4
“HELP” alternately with flickering effects on a 7-segment display
interface for a suitable period of time. Ensure a flashing rate that makes it
easy to read both the messages (Examiner does not specify these delay
values nor is it necessary for the student to compute these values).
10 Design and develop an assembly program to drive a Stepper Motor L4 CO1,2,3,4
interface and rotate the motor in specified direction (clockwise or counter-
clockwise) by N steps (Direction and N are specified by the examiner).
Introduce suitable delay between successive steps. (Any arbitrary value
for the delay may be assumed by the student).
11 Design and develop an assembly language program to L4 CO1,2,3,4
a. Generate the Sine Wave using DAC interface (The output of the DAC
is to be displayed on the CRO).
b. Generate a Half Rectified Sine waveform using the DAC interface.
(The output of the DAC is to be displayed on the CRO).
12 To interface LCD with ARM microprocessor. Write and execute L3 CO1,2,3,4
programs in C language for displaying text messages and numbers on
LCD.
13 To interface Stepper motor with ARM microprocessor. Write a program L3 CO1,2,3,4
to rotate motor in half step and full step mode.
14 Open ended experiment – 1 L4 -
Interfacing of temperature sensor with ARM freedom board (or any other
ARM microprocessor board) and display temperature on LCD
15 Open ended experiment – 2 L4 -
To design ARM cortex based automatic number plate recognition system
16 Open ended experiment – 3 L4 -
To design ARM based power saving system
8. REFERENCE:
1. Muhammad Ali Mazidi, Janice GillispieMazidi, Danny Causey, The
x86 PC Assembly Language Design and Interfacing, 5th Edition,
Pearson, 2013.
2. ARM System-on-Chip Architecture, Steve Furber, Second Edition,
Pearson, 2015.
3. ARM System Developer’s Guide, Designing and Optimizing
Software, Andrew N. Sloss,Dominic Symes, Chris W wight,
Elsevier, 2014.
-
C. EVALUATION SCHEME
For 2015, scheme (Module): Below a model scheme is presented. Faculty
may define their own scheme and write.
1. Record writing: 4 Marks
(Each experiment will be evaluated for 5 marks and average of
all the experiments will be taken)
n
E. EXPERIMENTS
1. EXPERIMENT NO:1
2. TITLE: BINARY SEARCH
3. LEARNING OBJECTIVES:
• To learn the implementation of binary search algorithm using
assembly language instructions.
4. AIM:
• To design and implement binary search algorithm using assembly
language instructions.
5. MATERIAL / EQUIPMENT REQUIRED:
• Intel CPU based computer
• MASM/TASM Assembler.
6. THEORY / HYPOTHESIS:
• A] Binary search is a well-known method for searching for an item
in a sorted array. In the beginning the search range is the whole
array. Then the search key is compared with the middle element of
the range. If they are equal, the wanted item has been found. If the
key is smaller, the same procedure is applied recursively to the left
half of the search range, otherwise to the right half as follows-
7. PROGRAMME:
.MODEL SMALL
.DATA
ARR DW 0111H, 0112H,
0113H, 0114H, 0115H LEN
DW ($-ARR)/2
KEY EQU 0112H
MSG1 DB "KEY IS
FOUND AT POSITION: "
POS DB ? ,13,10,"$"
MSG2 DB 'KEY NOT FOUND!!!!!!!!!!!!!. $'
.CODE
START: MOV AX, @DATA
n
BIG: JE FOUND
INC AX ; If the KEY is greater than the number compared.
MOV BX, AX
JMP AGAIN
n
12. RESULTS & CONCLUSIONS:
• -
• -
• -
13. LEARNING OUTCOMES:
• The binary search technique can be implemented in assembly language to search a
key element efficiently.
14. APPLICATION AREAS:
• Database applications
• To search a file in specified directory
15. REMARKS:
• -
• -
• -
-
1. EXPERIMENT NO: 2
2. TITLE: BUBBLE SORT
3. LEARNING OBJECTIVES:
• To learn the implementation of Bubble sort in assembly level language
4. AIM:
• To sort a given set of ‘n’ numbers in ascending and descending orders using
the Bubble Sort algorithm
5. MATERIAL / EQUIPMENT REQUIRED:
• Intel CPU based computer
• MASM/TASM Assembler.
6. THEORY / HYPOTHESIS:
• This program sorts a given unsorted list of numbers, using the Bubble Sort algorithm. The
unsorted list is initially stored in a series of memory locations called arr. After the program
execution, the same arr contains the sorted list. The sorting in ascending or descending
order is selected by the user during run-time. The algorithm of bubble sort is as follows-
PROGRAMME:
.MODEL SMALL
.DATA
NUMS DW
0FFFFh,0AAAAh,5555h,6666h,4444h,1111h,0cccch,3
333h LEN EQU ($-NUMS)/2
.CODE
START: MOV AX , @DATA ; Initialize the Data Segment.
MOV DS, AX
MOV CL, LEN-1 ; Number of passes.
NXTPAS: MOV CH, CL ; Number of comparisions.
LEA SI,NUMS
INT 3
END START
-
1. EXPERIMENT NO:3
2. TITLE: PALINDROME
3. LEARNING OBJECTIVES:
• To learn the implementation of checking string palindrome condition in
assembly language
4. AIM:
• To reverse a given string and check whether it is a palindrome.
5. MATERIAL / EQUIPMENT REQUIRED:
• Intel CPU based computer
• MASM/TASM Assembler.
6. THEORY / HYPOTHESIS:
• PALINDROME CHECK: This program waits till it receives a string of
characters from the standard input device(keyboard),terminated by the
carriage return, and stores the string in an array called str. The
reversed string is stored in another array called rev_str. The two
strings are compared character wise; for checking whether the original
string is palindrome. Necessary messages are displayed using DOS
function calls.
.CODE
START: MOV AX, @DATA ; Initialization of DS & ES.
MOV DS, AX
MOV ES, AX
-
• -
• -
1. EXPERIMENT NO: 4
2. TITLE: NCR CALCULATION
3. LEARNING OBJECTIVES:
• To learn the assembly language
implementation of computation of nCr. 4.
AIM:
• To compute nCr using recursive procedure. Assume that
n and r are non-negative numbers. 5. MATERIAL /
EQUIPMENT REQUIRED:
• Intel CPU based computer
• MASM/TASM Assembler.
6. THEORY / HYPOTHESIS:
• The ncr program computes nCr(no. of combinations of n, taken r at a time),using
recursive procedure where n and r are stored in wordwide memory locations.
Recursive definition for nCr:
Case1: If r=0 OR r=n, then nCr = 1
Case2: If r=1 OR r=n-1, then nCr = n
Case3: Other cases, nCr = (n-1)Cr + (n-
1)C(r-1) 7. PROCEDURE / PROGRAMME / ACTIVITY:
.MODEL SMALL
.DATA
n dw 4h
r dw 2h
ncr dw 0
.CODE
start: MOV AX, @DATA
MOV DS,AX
MOV AX,n
MOV BX,r call
encr MOV
AX,ncr MOV
AH,4CH INT
21H
encr proc near
CMP AL,BL
JE case1
CMP BL,0
JE case1
CMP BL,1
JE case21
DEC AL
CMP BL,AL
JE case22
PUSH AX
PUSH BX
CALL
ENCR POP
BX POP AX
DEC BL
PUSH AX
PUSH BX
CALL
ENCR POP
BX POP AX
RET
case1: INC NCR
RET
case22: INC NCR
case21: ADD NCR,Ax
RET
encr endp
END START
-
1. EXPERIMENT NO: 5
2. TITLE: DISPLAY THE CURRENT TIME FROM THE SYSTEM
3. LEARNING OBJECTIVES:
• To learn the implementation reading current time from the system and displaying it.
4. AIM:
• To read the current time from the system and display it in the standard format on the screen.
5. MATERIAL / EQUIPMENT REQUIRED:
• Intel CPU based computer
• MASM/TASM Assembler.
6. THEORY / HYPOTHESIS:
• The program for reading system time reads the system time ,using DOS ;function call
number 2CH. The hour, minute and second are returned in CH, CL and DH registers
(in HEX form) respectively, by the DOS function. It is then converted into ASCII for
display purpose. The timing is displayed, approximately at the center of the screen.
7. PROCEDURE / PROGRAMME / ACTIVITY:
.MODEL SMALL
.STACK
.DATA
MSG DB 'THE CURRENT TIME IS: $'
.CODE
START: MOV AX, @DATA ; Initialize DS.
MOV DS, AX
MOV AL, CL
AAM ; ASCII adjust.
MOV BX, AX
CALL DISP ; Procedure to display.
MOV DL, BL
ADD DL, 30H
MOV AH, 02H
INT 21H
RET
DISP ENDP
END START
1. EXPERIMENT NO: 6
2. TITLE: ARM MICRO PROCESSOR PROGRAMMING IN ASSEMBLY LANGUAGE
3. LEARNING OBJECTIVES:
• To learn the process of writing and simulating ARM assembly language programs for
data transfer, arithmetic and logical operations.
4. AIM:
• To write and simulate ARM assembly language programs for data transfer, arithmetic
and logical operations.
5. MATERIAL / EQUIPMENT REQUIRED:
• PC with windows 7 OS and minimum 1GB RAM
• KEIL-5 MDK-ARM with Legacy support
6. THEORY / HYPOTHESIS:
• The ARM processor is easy to program at the assembly level.
The state of an ARM system is determined by the content of visible registers and memory.
• A user-mode program can see 15 32-bit general purpose registers (R0-R14),
program counter (PC) and CPSR.
• Memory system of ARM is a linear array of bytes addressed from 0 to 232-1.
• ARM instructions are all 32-bit long (except for Thumb mode). There are
232 possible machine instructions. Fortunately, they are structured.
• Features of ARM instruction set-
• Load-store architecture
• 3-address instructions
• Conditional execution of every instruction
• Possible to load/store multiple registers at once
• Possible to combine shift and ALU operations in a single instruction
• Instruction set is of following types:
• Data processing
• Data movement
• Flow control
7. PROCEDURE / PROGRAMME / ACTIVITY:
TTL ADDITION PROGRAM ;Title of the program, should start with TTL
AREA PROG, CODE, READONLY ;store this application PROG in code
memory(EEPROM)and an apllication is always readonly in ARM.
EXPORT MAIN ;exporting MAIN defined in statup.s and link that Main to
current Main this.
ENTRY ;Entry point to body of the program
MAIN ;main function
MOVS R1, #0X21 ;load 21h to RO with effect on status register
MOVS R2, #21 ;load 21D to R1 (equivalent to 15H)
ADD R1, R1, R2 ;R1=R1+R2
HERE B HERE ;stay here/infinite loop
END
---------------------------------------------------------------------------------------------
TTL SUBTRACTION PROGRAM
AREA PROG, CODE, READONLY
EXPORT MAIN
ENTRY
MAIN
MOVS R1, #0X21
MOVS R2,#21
SUBC R1, R1, R2 ;R1=R1-R2 (destination and second operand must be same)
HERE B HERE
END
---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
• -
15. REMARKS:
• -
• -
• -
-
1. EXPERIMENT NO: 7
2. TITLE: ARM MICRO PROCESSOR PROGRAMMING IN 'C' LANGUAGE
3. LEARNING OBJECTIVES:
• To learn the process of writing and simulating C Programs for ARM microprocessor in KEIL
4. AIM:
• To write and simulate C Programs for ARM microprocessor in KEIL
5. MATERIAL / EQUIPMENT REQUIRED:
• PC with windows 7 OS and minimum 1GB RAM
• KEIL-5 MDK-ARM with Legacy support
6. THEORY / HYPOTHESIS:
• ARM microprocessor programming basics in C:
Bitwise or bitlevel operations form the basis of embedded programming. The
interconversion between Hexadecimal and Binary we can start with Bitwise(or bit
level) operations in C. There are bascially 6 types of Bitwise operators. These are :
#include "lpc17xx.h"
#include "stdio.h" int
main(void)
{
uint16_t a, b;
uint32_t REG,x;
uint8_t REG_8b;
char n1,n2,n3;
/*1's complement/negation in
ARM*/ x=0x0FFF000F;
REG = ~(x);
#include <lpc214x.h>
void delay(void);
int main(void)
{
IO0DIR = 0xFFFFFFFF; // Configure all pins on Port 0 as Output
while(1)
{
IO0SET = 0xFFFFFFFF; // Turn on LEDs
delay();
IO0CLR = 0xFFFFFFFF; // Turn them off
delay();
}
return 0; // normally this wont execute
}
void delay(void)
{
int z,c;
c=0;
for(z=0; z<4000000; z++)
{
c++;
}
}
14. REMARKS:
the GPIO peripherals of the ARM processor are programmed using c
language 13. LEARNING OUTCOMES :
Basic arithmetic and logical operation on ARM processor can be performed
using C language
• the peripherals of the ARM processor can be efficiently programmed using c
language 14. APPLICATION AREAS:
• -
• -
• -
-
1. EXPERIMENT NO: 8
2. TITLE: A) LOGIC CONTROLLER INTERFACE – BCD UP-DOWN COUNTER
B) LOGIC CONTROLLER INTERFACE – READ TWO 8-BIT INPUTS (X & Y)
AND DISPLAY X*Y
3. LEARNING OBJECTIVES:
• To learn the implementation of BCD up-counter in Logic Controller Interface.
• To learn the implementation of multiplication of two numbers on Logic Controller Interface.
4. AIM:
• To interface Logic Controller Interface kit to the microprocessor and design and
develop an ALP to perform BCD up-down counter.
• To interface Logic Controller Interface kit to the microprocessor and design and
develop an ALP to read the status of two 8-bit input bytes (X and Y) from the LCI,
and display X*Y on it. from the Logic Controller Interface and display X*Y.
5. MATERIAL / EQUIPMENT REQUIRED:
• Intel CPU based computer
• Logic Controller Interface kit
• FRC connector.
• 7-segment LED Interface kit
6. THEORY / HYPOTHESIS:
• BCD up-down counter: The program initiates a BCD up-down counter. The content of
accumulator is incremented from zero in BCD form(with proper time delay between
increments),and displayed in the Logic controller interface card in binary form. When the
display reaches 99, down counter is initiated. When the count is down to 00,the program
gets terminated. The program 2b2 imitates a ring counter. Immediate number 1 is moved to
accumulator, and is rotated right once at a time, with proper delay between rotations, and
displayed in Logic controller; interface card, until any key of the keyboard is pressed.
• The program inputs a byte (X) from the Logic controller card through port-B. Then the
processor is made to enter a wait loop, using a DOS function number 0Bh. During this
waiting period, the second byte (Y) is manually set in the card. After that, when any key
of the keyboard is pressed, processor comes out of the waiting loop and inputs the byte
Y. The two input bytes are multiplied. Low byte of the product is displayed first, and
then after a time delay, the high byte of the product is displayed, though port-A.
7. PROCEDURE / PROGRAMME / ACTIVITY:
.CODE
START: MOV AX, @DATA
MOV DS, AX
END START
.DATA
MSG1 DB 13,10,"LOGIC CONTROLLER INTERFACE - READ TWO
8 BIT INPUTS (X & Y) AND DISPLAY X*Y...",13,10,'$'
MSG2 DB 13,10,"Accept the value of X through Interface card
and press any key.$" MSG3 DB 13,10,"Accept the value of Y
through Interface card and press any key.$" MSG4 DB
13,10,"Press any key to observe the value of X*Y.$"
PA EQU 0CD00H ; Port address for ESA Module.
PB EQU 0CD01H
PC EQU 0CD02H
CR EQU 0CD03H
CW DB 82H ; Control Word for ESA Module.
PRINT MACRO MSG ; Macro to write messages.
LEA DX, MSG
MOV AH, 09H
INT 21H
ENDM
.CODE
START:
MOV AX,
@DATA
MOV DS,
AX
INT 21H
MOV DX, PB
IN AL, DX ; If yes, read data for Y.
PUSH AX
PRINT MSG4 ; To display MSG4.
POP AX
MOV DX, PA
OUT DX, AL ; Send lower order byte of product.
CALL DELAY ; Wait.
MOV AL, AH
MOV DX, PA
OUT DX, AL ; Send high order byte of product.
END START
8. BLOCK / CIRCUIT / MODEL DIAGRAM / REACTION EQUATION: NA
9. OBSERVATION TABLE / LOOKUP TABLE / TRUTH TABLE: NA
10. FORMULA / CALCULATIONS:
• 0 0 0 0 0 0 0 0 (FF H) * 0 0
0 0 0 0 0 0 (02 H) Result:
LSB: 0 0 0 0 0 0 0 0 (FE H)
MSB: 0 0 0 0 0 0 0 0 (01 H)
12. RESULTS & CONCLUSIONS:
• -
15. REMARKS:
•
-
1. EXPERIMENT NO: 9
2. TITLE: A) 7-SEGMENT DISPLAY INTERFACE – DISPLAY MESSAGES FIRE AND
HELP
3. LEARNING OBJECTIVES:
• To learn the interfacing of 7segment LED display kit to the microprocessor and
display alphanumeric characters on it.
• -
• -
• -
4. AIM:
• To interface 7-Segment LED kit to the microprocessor and design and develop an
ALP to Display messages FIRE and HELP alternatively with flickering effects on a
7-segment display interface for a specified period of time.
• -
5. MATERIAL / EQUIPMENT REQUIRED:
• Intel CPU based computer
• 7-Segment LED Interface kit
• FRC connector.
6. THEORY / HYPOTHESIS:
• The hardware uses four shift register ICs 74164. 74164 is an 8-bit serial in-parallel out shift
register with asynchronous reset and two input pins. It requires 8 clock cycles at “CLK” pin
to shift the serial data from input to 8 parallel outputs. After 8 shifts, the first serial bit will be
in output QH, and only now the data at output is valid. To cascade more 74164 shift
register IC need to connect the last output QH to the input of second shift register.
The output is connected to the cathode of the LEDs in the 7 segment display and thus
common anode displays are used. The anode is connected to +Vcc..The last output of
nd
the first sift register is connected to input of the 2 shift register and the last output o f
nd shift register to input of 3rd and so on. Thus the shift register are serial in parallel
2
out and they are connected to displays, in such a way that output 0A is connected to
display segment ‘a’ and 0B to ‘b’ and so on up to 0H; through 330 ohm resistors.
The shifting of data bit takes place for each clock cycle. 7404 IC used provides
isolation and the interface board gets 5V through port bit.
Pin 1 is used as data pin and pin 2 is used as other input to Vcc. The clock signal is
generated at a port bit which will be connected to the clock of the shift register.
PB0 is used for data bit; and PC0 for clock through which a falling edge has to be sent.
The microprocessor stores the display information in a RAM. Each time a display has to be
updated the microprocessor fetches all bytes one by one from RAM and
outputs corresponding display codes serially that is bit by bit to display.
Hexadecimal code is stores in the RAM. The code conversion from hexa
to 7 segment is done just before the display is updated.
The 7 segment display is used as a numerical indicator on many types of
test equipment. It is an assembly of light emitting diodes which can be
powered individually. There are two important types of 7-segment LED
display.
In a common cathode display, the cathodes of all the LEDs are joined
together and the individual segments are illuminated by HIGH voltages.
In a common anode display, the anodes of all the LEDs are joined
together and the individual segments are illuminated by connecting to a
LOW voltage.
Display code
Since the outputs of shift registers are connected to cathode sides of
displays, low input must be given to segments for making them glow and
high inputs for making them blank. Each display has 8 segments (a, b, c,
d, e, f, g, h) as shown. For displaying any character the corresponding
segment must be given low inputs.
•
The one shown above is a common anode display since all anodes are
joined together and go to the positive supply. The cathodes are connected
individually to zero volts. Resistors must be placed in series with each
diode to limit the current through each diode to a safe value. The d.p
represents a decimal point.
The following table shows how to form characters: '0' means that pin is
connected to ground. '1' means that pin is connected to Vcc.
• STRING: HELP
• d.p g f e d c b a
• 1 0 0 0 1 1 0 0 ---- P (8CH)
• 1 1 0 0 0 1 1 1 ---- L (C7H)
• 1 0 0 0 0 1 1 0 ---- E (86H)
• 1 0 0 0 1 0 0 1 ---- H (89H)
DB inputs are high, output of AND gate which is the actual serial Input for
the shift register is nothing but the input DA which is connected to the
Least Significant Bit of port B (PB0). PCo, Least Significant Bit of port C
has been internally connected to the clock i/p of all 74164 IC’s.
.CODE
START: MOV AX, @DATA
MOV DS, AX
MOV AL, CW
MOV DX, CR
OUT DX, AL
AGAIN: LEA SI, STR1 ; Get base address of STR1(FlrE},
CALL DISP_STR ; to display string on SSD.
CALL DELAY ; Wait.
LEA SI, STR2 ; Get base address of STR2(HELP),
CALL DISP_STR ; to display message on SSD.
CALL DELAY ; Wait
15. REMARKS:
•
-
1. EXPERIMENT NO: 10
2. TITLE: STEPPER MOTOR INTERFACE – CLOCKWISE OR
COUNTER-CLOCKWISE
3. LEARNING OBJECTIVES:
• To learn the interfacing of Stepper motor to the microprocessor and
to rotate it in a specified.
4. AIM:
• To drive a stepper motor interface to rotate the motor in specified
direction (clockwise or counter-clockwise) by N steps by introducing
suitable delay between successive steps. (Any arbitrary value for the
delay may be assumed by the student).
5. MATERIAL / EQUIPMENT REQUIRED:
• Intel CPU based computer
• Stepper motor driver Interface kit
• FRC connector.
6. THEORY / HYPOTHESIS:
• The ncr program computes nCr(no. of combinations of n, taken r
at a time),using recursive procedure where n and r are stored in
wordwide memory locations.
Recursive definition for nCr:
Case1: If r=0 OR r=n, then nCr = 1
Case2: If r=1 OR r=n-1, then nCr = n
Case3: Other cases, nCr = (n-1)Cr + (n-1)C(r-1)
• In a permanent magnet stepper motor, the rotor is a permanent
magnet and stator is electromagnet. The rotor positions itself is such
that its poles lock with corresponding opposite poles of the stator.
Stepper motor control is a very popular application of
microprocessor system, in industrial process- control area, since stepper
motor is capable of accepting pulses directly from the microprocessor,
and rotates accordingly. F or clockwise direction of rotation, the voltage
application sequence for the coils is 3,2,1,0.
.MODEL SMALL
.STACK
.DATA
PA EQU 0cd00H ; Port address in ESA Module.
PB EQU 0cd01H
PC EQU 0cd02H
CR EQU 0cd03H
CW EQU 80H ; Port-A Out, Mode 0, I/O.
COUNT DB 200 ; 200 steps.
MSG DB 13,10,"STEPPER MOTOR INTERFACE - CLOCKWISE OR COUNTER-
CLOCKWISE...$"
.CODE
START: MOV AX, @DATA
MOV DS, AX
LEA DX, MSG ; To write MSG.
MOV AH, 09H
INT 21H
MOV DX, CR
MOV AL, CW
OUT DX, AL
MOV DX, PA
MOV AL, 88H ; AL = 10001000B. 88, 44, 22, 11 for Clockwise.
MOV CX, 00H
MOV CL, COUNT
END START
8. BLOCK / CIRCUIT / MODEL DIAGRAM / REACTION EQUATION: NA
9. OBSERVATION TABLE / LOOKUP TABLE / TRUTH TABLE: NA
10. FORMULA / CALCULATIONS:
Number of step required for 90 degree rotation = 90/1.8 =
Number of step required for 90 degree rotation = 360/1.8 =
11. GRAPHS / OUTPUTS:
• Stepper motor runs in counter-clockwise direction, for 200 steps and then stops.
• Stepper motor runs in clockwise direction, for 200 steps and then stops.
-
1. EXPERIMENT NO: 11
2. TITLE: A) DAC INTERFACE – SINE WAVE
B) DAC INTERFACE – HALF RECTIFIED SINE WAVE
3. LEARNING OBJECTIVES:
• To learn the generation of sinusoidal wave forms using microprocessors.
• To learn the generation of Half rectified sine waveforms using microprocessors.
4. AIM:
• To generate the Sine Wave using the DAC interface (The output of the DAC is to be
displayed on the CRO)
• To generate a Half rectified sine wave-form using the DAC interface (The output of
the DAC is to be displayed on the CRO).
5. MATERIAL / EQUIPMENT REQUIRED:
• Intel CPU based computer
• DAC Interface kit
• FRC connector.
6. THEORY / HYPOTHESIS:
• A) The dual DAC interface can be used to generate different interesting waveforms using
the microprocessor. The reference voltage needed for the DAC is obtained from an on-
board voltage regulator uA723/uA741. The voltage generated by this regulator is about 8V.
The outputs from the DAC vary between 0 to 5V corresponding to the values between 00H
to FFH. The digital inputs to DAC are provided through the ports of 8255, and the analog
outputs from the DAC are given to operational amplifiers which acts as current to voltage
converters. Refer to the schematics of DAC given in the above Figure.
The Port A and Port B of 8255 PPI are used as output ports. The outputs from the
OpAmp are connected to Xout and Yout, from which the waveforms are observed
on a CRO. Port A is used to control Xout and Port B is used to control Yout.
The value of digital output (from MP, through Port A) is stored in the array called
table. The value for each element of the table is calculated using the formula,
Table = 127 + 127sinθ.
• The value of digital output for every 6˚ rise (up to 180˚ electrical)is stored in the table. For
the next 180˚, the element values of table are simply inverted by NOT instruction, with negligible error. The addition of the
constant 127 (Amplitude of sine wave here) in the formula has a convenience because if we calculate the table values by just
127sinθ, we get negative values (for θ between 180˚ to 360˚), which is more complicated for table formation here in ALP. The
above formula has ensured that negative elements are not in table array. The value 127 corresponds the reference line (i.e. X-
axis).
• B) This program is much similar sine wave generation except that the second loop instructions out only the reference line
digital output(i.e. 127d)for 31 times. So analog output will be confined to only to the reference line during 180˚ to 360˚,
producing a half rectified sine wave on the CRO.
This program outputs 8-bit digital value to the Digital-to-Analog converter(i.e. DAC).The digital output is varied
according to sine wave function, for every 6˚(electrical), only during 0˚ to 180˚.For 180˚ to 360˚ ,the digital
output corresponds to only the reference line(i.e. 127d). So we can observe a half rectified sine wave at the output of DAC,
using a CRO(Digital data = 127 + 127sinθ). The digital data is stored in the array called table.
.MODEL SMALL
.STACK
.DATA
PA EQU 0CD00H ; Port address in ESA Module.
PB EQU 0CD01H
PC EQU 0CD02H
CR EQU 0CD03H
CW EQU 80H ; Port-A Out.
VALUES DB 127, 140, 153, 166, 178, 190, 201, 212
DB 221, 229, 236, 243, 247, 251, 253, 254
DB 253, 251, 247, 243, 236, 229, 221
DB 212, 201, 190, 178, 166, 153, 140, 127
MSG DB 13,10,"DAC INTERFACE - SINE WAVE...$"
.CODE
START: MOV AX, @DATA
MOV DS, AX
MOV DX, PA
NC: LEA SI, VALUES
MOV CX, 31D
NA1:MOV AL, [SI]
OUT DX, AL
nINC SI
LOOP NA1
LEA SI, VALUES
MOV CX, 31D
NA2:MOV AL, [SI]
NOT AL
OUT DX, AL
INC SI
LOOP NA2
JMP NC
END START
.MODEL SMALL
.STACK
.DATA
PA EQU 0CD00H ; Port address in ESA Module.
PB EQU 0CD01H
PC EQU 0CD02H
CR EQU 0CD03H
CW EQU 80H ; Port-A Out.
VALUES DB 127, 140, 153, 166, 178, 190, 201, 212
DB 221, 229, 236, 243, 247, 251, 253,
254 DB 253, 251, 247, 243, 236, 229, 221
DB 212, 201, 190, 178, 166, 153, 140, 127
MSG DB 13,10,"DAC INTERFACE – HALF-RECTIFIED SINE WAVE...$"
.CODE
START: MOV AX, @DATA
MOV DS, AX
LEA DX, MSG ; To write MSG. MOV AH, 09H
INT 21H
MOV DX, CR
MOV AL, CW
OUT DX, AL
MOV DX, PA
NC: LEA SI, VALUES
MOV CX, 31D
NA: MOV AL, [SI]
OUT DX, AL
INC SI
LOOP NA
COURSE LABORATORY MANUAL
• The sinusoidal waveform can be generated by the microprocessor by giving suitable values to the DAC.
15. REMARKS:
•