Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
LAB MANUAL
2015-2015 (ODD SEMESTER)
III EEE
EX NO:.. DATE:
CYCLE OF EXPERIMENTS
TABLE OF CONTENTS
Staff Incharge
The trainer encompasses a central processing unit (CPU) associated with input and output
peripherals.
a) CPU:
i) ALU:
Input and output series (buses) by which the processor can retrieve and transmit
data to external unit.
The I/O devices can be categorized into general purpose and special purpose devices. The
common general-purpose peripheral devices are:
Each I/O device is accessed by a binary address known as device address or port address.
To transfer data to peripherals, the microprocessor places an appropriate address on the
appropriate bus, transmit control bus to enable the device and then to transfer data.
The 8155 and 8255 ICs both contributes I/O ports and can be programmable to transfer
data either in simple I/O or interrupt I/O mode. The I/O portion consists of general-purpose
registers and control registers in addition to the I/O ports.
The 8155 and 8253 provided timer/counter circuits. In addition to the I/O ports 8155
consists of 256 bytes of RAM and 14 bit timers. Here, all modes of operation are software
programmable.
iii) ROM:
ROM is used for system initialization and operation. It is a non-volatile semi conductor
memory, which is used to store the monitor program of MPU. It consists of continuous and
consecutive series of location which can store particular data in a specified address. This is done
by burning certain locations and user programmable ROM known as PROM. Such IC can be
programmed only once. However, data entered in EPROM can be erased by the application of
some special methods.
iv) RAM:
The keyboard / display panel is centered on an 8279 Key board Display controller. The
8279 is responsible for the keyboard matrix and display units. The 8279 port functions are
dependant on the Ao address bit and R/W control signal received by it.
The MP executes its program at a rate set by its clock. A program is a sequence of
instructions, which enables a computer to perform a particular task. A computer program
includes data sequence and memory address represented in a Hexadecimal format. The methods
of entry of instructions vary from kit to kit. To store data in a specified memory location, the
procedure adapted is as follows:
PROGRAM EXECUTION:
To execute a program, the MP should be directed to the starting address of the program.
The processor begins the execution of the program by following the first machine code. The
processor decodes the code by matching it with its predefined set of instructions and performs
the specified task. Fetching, decoding and performing the task are continued one after the other
and sequentially till the processor is instructed to halt. To encode a program stored in specified
set of memory locations the procedure adopted are as follows:
PREREQUISITE
1. Define bit and byte
2. What is the size of data bus and address bus of 8085 microprocesssor?
3. What are the registers available in 8085 microprocessor?
4. Why 8085 is 8-bit processor?
5. What is flag register?
AIM
To write a assembly language program to add single byte numbers using direct
addressing mode.
APPARATUS REQUIRED
1. 8085 microprocessor trainer kit
2. Power supply
ALGORITHM
1. Load the 1st data in the accumulator.
2. Transfer the data from accumulator to B register.
3. Now load the second data in the accumulator.
4. Transfer the data from accumulator to C register.
5. Add the content of C reg. with the acc.
6. Increment B reg. if there is a carry.
7. Store the result in a memory location.
8. Halt the program.
PREREQUSITES:
1. How will you perform subtraction in 8085?
2. What are the instructions used for data transfer?
3. Which registers are used as memory pointer?
4. Where the results of arithmetic/logical operations are stored? Why?
5. Which instruction is used to increment the memory?
6. What are the instructions used to clear the accumulator content?
FLOWCHART
Start
If
Carry
Yes
No
Stop
PROGRAM
EXECUTION
INPUT OUTPUT
ADDRESS VALUE ADDRESS VALUE
EVALUAVTION
INFERENCE
RESULT
Thus the addition of two single byte numbers using direct addressing mode is executed
and output is verified.
APPARATUS REQUIRED
1. 8085 microprocessor trainer kit
2. Power supply
ALGORITHM
1. Initialize B register.
2. Load the 1st data in the accumulator.
3. Subtract the 2nd data with the contents of accumulator.
4. If there exists a carry, increment B register.
5. Store the contents of the accumulator in a memory location.
6. Move the contents of B register to next memory location.
7. Halt the program.
FLOWCHART
Start
Initialize B register
If No
Carry
Yes
Increment B reg.
Move B content to
Stop
PROGRAM
EXECUTION
INPUT OUTPUT
ADDRESS VALUE ADDRESS VALUE
EVALUAVTION
INFERENCE
RESULT
Thus the subtraction of two single byte numbers using immediate addressing mode is
executed and output is verified.
AIM
To write an 8085 assembly language program to perform single byte multiplication.
APPARATUS REQUIRED
ALGORITHM
FLOW CHART
PROGRAM
EXECUTION
INPUT OUTPUT
ADDRESS VALUE ADDRESS VALUE
EVALUAVTION
INFERENCE
RESULT
Thus the 8085 assembly language program for multiplication of two single byte numbers
is performed.
AIM
To write an 8085 assembly language program to perform single byte division.
APPARATUS REQUIRED
ALGORITHM
FLOW CHART
PROGRAM
EXECUTION
INPUT OUTPUT
ADDRESS VALUE ADDRESS VALUE
EVALUAVTION
INFERENCE
RESULT
Thus the 8085 assembly language program for division of two single byte numbers is
performed.
AIM:
To write a program to sort a given array of data in ascending / descending order. The first
data in array being array size.
APPARATUS REQUIRED:
ALGORITHM:
Step 1: Load the HL pair with the starting address of the array.
Step 2: Load two registers B and C with the array size and set it as counter.
Step 3: Increment the pointer and load the data in acc. & set to sort it.
Step 4: Increment the pointer to compare it with the data in acc.
ASCENDING ORDER
Step 5: If carry occurs during comparison then it is in ascending order. So continue sort the next
data in the array.
Step 6: Continue to sort the data by decrementing the counter and incrementing the pointer until
all data are compared.
Step 7: Halt the program.
DESCENDING ORDER
Step 5: If carry does not occurs during comparison then it is in descending order. So continue
sort the next data in the array. If carry does not occur then exchange the two data in
adjacent memory location.
Step 6: Continue to sort the data by decrementing the counter and incrementing the pointer until
all data are compared.
Step 7: Halt the program.
PREREQUISITES
1. -------------- instruction is used to compare memory with accumulator content
2. -------------- instruction is used to compare register with accumulator content
3. -----------------flags are used to indicate the result of comparision
4. Difference between conditional jump and unconditional jump
5. What is the status of carry flag and zero flag when accumulator content is greater than
memory/register content?
6. What is the status of carry flag and zero flag when accumulator content is lesser than
memory/register content?
7. What is the status of carry flag and zero flag when accumulator content is equal to
memory/register content?
FLOWCHART
Start
Increment HL pair by 1
Decrement C
If
Decrement B reg. by 1
If
Stop
PROGRAM
EXECUTION
INPUT OUTPUT
ADDRESS VALUE ADDRESS VALUE
EVALUAVTION
INFERENCE
RESULT
Thus the assembly language program to sort a given array of data in ascending /
descending order is executed and output is verified.
AIM
To write an 8085 assembly language program to find the largest and smallest of given
numbers.
APPARATUS REQUIRED
1. 8085 MP trainer kit
2. Power supply
ALGORITHM
1. Start the program.
2. Initialize C register with the number of input values.
3. Get the input values in memory in H, L pair.
4. Load the accumulator with the first value.
5. a) Compare the accumulator with memory, if carry flag is set move memory value to
accumulator, to find largest.
b) Compare the accumulator with memory, if carry flag is not set move memory value to
accumulator, to find smallest.
6. Decrement the count, repeat step 5 until count turns zero.
7. Store the accumulator value to respective register.
8. Stop the program.
FLOW CHART
PROGRAM
EXECUTION
INPUT OUTPUT
ADDRESS VALUE ADDRESS VALUE
EVALUAVTION
INFERENCE
RESULT
Thus the 8085 assembly language program to find the largest and smallest of given
numbers is performed.
PREREQUISITES:
1. Name some stack related instructions
2. What are the logical instructions available in 8085?
3. instruction performs logical AND operation with immediate data
4. instruction helps to transferred the program control from the subroutine to the
main program
5. What is PUSH and POP instructions?
6. Name the instructions used for rotate operations
7. Which are the instructions that affect the sequence flow of 8085 assembly language program?
FLOW CHART
Start
Increment B reg. If A = 0
add 64 to acc
Increment C reg. If C = 1
add 0A to acc
Add B reg.
Stop
PROGRAM
EXECUTION
INPUT OUTPUT
ADDRESS VALUE ADDRESS VALUE
EVALUAVTION
INFERENCE
RESULT
Thus the program to convert hexadecimal to decimal is executed and output is verified.
FLOW CHART
Start
Load accumulator
Clear Accumulator.
If C = 0
Stop
PROGRAM
EXECUTION
INPUT OUTPUT
ADDRESS VALUE ADDRESS VALUE
EVALUAVTION
INFERENCE
RESULT
Thus the program to convert decimal to hexadecimal is executed and output is verified.
FLOW CHART
Start
Rotate right to 07
Call ASCBIN
Call ASCBIN
Stop
If carry
Return main
PROGRAM
EXECUTION
INPUT OUTPUT
ADDRESS VALUE ADDRESS VALUE
EVALUAVTION
INFERENCE
RESULT
Thus the program to convert Binary to ASCII is executed and output is verified.
SRI KRSIHNA COLLEGE OF TECHNOLOGY
63
MICROPROCESSOR AND MICROCONTROLLER LABORATORY
EX NO:.. DATE:
FLOW CHART
Start
Rotate right to 07
Call ASCBIN
Call ASCBIN
Stop
Return main
PROGRAM
EXECUTION
INPUT OUTPUT
ADDRESS VALUE ADDRESS VALUE
EVALUAVTION
INFERENCE
RESULT
Thus the program to convert ASCII to Binary is executed and output is verified.
AIM:
To write an assembly language program to add two 32-bit numbers using 8086.
APPARATUS REQUIRED:
ALGORITHM:
PREREQUISITES:
1. Difference between 8085 and 8086
2. How many address lines and data lines available in 8086?
3. List the flags of 8086
4. What are the registers available in 8086?
5. -------------- instruction is used to perform multiplication operation
6. instruction is used to perform division operation
FLOWCHART
PROGRAM
EXECUTION
INPUT OUTPUT
ADDRESS VALUE ADDRESS VALUE
EVALUAVTION
INFERENCE
RESULT
Thus the addition of two 32-bit numbers using 8086 is executed and output is verified.
SRI KRSIHNA COLLEGE OF TECHNOLOGY
75
MICROPROCESSOR AND MICROCONTROLLER LABORATORY
EX NO:.. DATE:
AIM:
To write an assembly language program to subtract two 32-bit numbers using 8086.
APPARATUS REQUIRED:
ALGORITHM:
FLOWCHART
START
STOP
PROGRAM
EXECUTION
INPUT OUTPUT
ADDRESS VALUE ADDRESS VALUE
EVALUAVTION
INFERENCE
RESULT
Thus the subtraction of two 32-bit numbers using 8086 is executed and output is verified.
AIM:
To write an assembly language program to multiply two 16-bit numbers using 8086.
APPARATUS REQUIRED
ALGORITHM
FLOWCHART
PROGRAM
EXECUTION
INPUT OUTPUT
ADDRESS VALUE ADDRESS VALUE
EVALUAVTION
INFERENCE
RESULT
Thus the multiplication of two 16-bit numbers using 8086 is executed and output is
verified.
SRI KRSIHNA COLLEGE OF TECHNOLOGY
87
MICROPROCESSOR AND MICROCONTROLLER LABORATORY
EX NO:.. DATE:
AIM:
To write an assembly language program to divide two 16-bit numbers using 8086.
APPARATUS REQUIRED
ALGORITHM
FLOWCHART
PROGRAM
EXECUTION
INPUT OUTPUT
ADDRESS VALUE ADDRESS VALUE
EVALUAVTION
INFERENCE
RESULT
Thus the division of two 16-bit numbers using 8086 is executed and output is verified.
8085 MICROPROCESSOR
AIM
To convert a analog signal into a digital signal and display it in a field of 7 segment
display using 8085 microprocessor.
APPARATUS REQUIRED
ALGORITHM
PREREQUISITES
1. Which instructions are used to communicate 8085 with external peripherals?
2. What are the different types of ADC?
3. What is the significance of end of conversion signal while interfacing A/D converter to a
microprocessor?
4. Why ADC and DAc is used in the microprocessor based systems?
5. What is the need of D/A converter
FLOWCHART:
CIRCUIT DIAGRAM:
THEORY
The eight data output of ADC are connected to D0-D7 through a buffer 74LS244.
Provision is made to display the data output by means of LEDs using a latch 74LS374. This latch
is allotted by End of Conversion signal. Thus, after the conversion is completed, at the rising
edge of EOC, the 74LS374 latches the digital output of ADC. The LEDs which are connected to
output pins of the latch, display the data automatically.
The EOC of ADC can be connected to RST5.5, RST6.5, RST7.5. So the EOC output can
be used to interrupt the CPU in turn, can input the digital data from ADC.
Start of Conversion can be given externally using the SOC Switch available on the
board.
Thus the buffer 74LS244 which transfers the converted data outputs to data bus is
selected when,
A7 A6 A5 A4 A3 A2 A1 A0
1 1 0 0 1 X X X
= C8 (Hex).
The start of conversion can be given using software also. The flip-flop which transfers
the D0 line status to the SOC pin of the ADC is selected when,
A7 A6 A5 A4 A3 A2 A1 A0
1 1 0 1 0 X X X
=D0 (Hex).
The EOC output of ADC is transferred to the data line D0, when,
A7 A6 A5 A4 A3 A2 A1 A0
1 1 0 1 1 X X X
= D8 (Hex).
PROGRAM
PROCEDURE:
EXECUTION
INPUT OUTPUT
ADDRESS VALUE ADDRESS VALUE
EVALUAVTION
INFERENCE
RESULT
Thus the program to convert an analog signal to the corresponding digital signal using
8085 microprocessor is executed. The output is displayed in the 7 segment display of the 8085
kit and the output is verified.
APPARATUS REQUIRED
1. 8085 Microprocessor trainer kit
2. CRO
3. DAC Interfacing kit.
A) SQUARE WAVE
ALGORITHM
1. Start the program
2. Move the minimum value of the square wave to the accumulator.
3. Move the accumulator contents to the output port.
4. Call the Delay subroutine.
5. Move the maximum value of the square wave to the accumulator.
6. Move the accumulator contents to the output port.
7. Call the Delay subroutine.
8. Jump to start of the program till the delay value becomes zero.
9. Delay Subroutine: Move the delay value to B register.
10. Loop 1: Move the maximum value of the wave to the C register.
11. Loop 2: Decrement the value of C register.
12. Jump on no zero of the C register to the loop 2.
13. Decrement the value of B register.
14. Jump on no zero of the B register to the loop 1.
15. Repeat the process.
OUTPUT
MODEL GRAPH
SQUARE WAVE
PROGRAM
ADDRESS LABEL MNEMONICS HEXCODES COMMENTS
Move the value 00 to
4100 START MVI A,00 3E 00
accumulator.
Send the value from the
4102 OUT C0 D3 C0
accumulator to the port.
4104 CALL DELAY CD 11 41 Call DELAY subroutine.
Move the value FF to the
4107 MVI A,FF 3E FF
accumulator.
Send the value from the
4109 OUT C0 D3 C0
accumulator to the port.
410B CALL DELAY CD 11 41 Call DELAY subroutine.
Jump to the START of
410E JMP START C3 00 41
the program.
Move the value 05 to B
4111 DELAY MVI B,05 06 05
register.
Move the value FF to C
4113 LOOP 1 MVI C,FF 0E FF
register.
Decrement the value of
4115 LOOP 2 DCR C 0D
C register.
Jump on non zero of the
4116 JNZ LOOP 2 C2 15 41 C register to the Loop 2
subroutine.
Decrement the value of
4119 DCR B 05
B register.
Jump on non zero of the
411A JNZ LOOP 1 C2 13 41 B register to the Loop1
subroutine.
411D RET C9 Return to the program.
B) TRIANGULAR WAVE
ALGORITHM
1. Start the program
2. Loop 1: Move the starting value of the triangular wave to the L register.
3. Move the value from the L register to the accumulator.
4. Move the accumulator contents to the output port.
SRI KRSIHNA COLLEGE OF TECHNOLOGY
102
MICROPROCESSOR AND MICROCONTROLLER LABORATORY
EX NO:.. DATE:
MODEL GRAPH
TRIANGULAR WAVE
PROGRAM
PROCEDURE
1. The opcodes are entered to the microprocessor
2. The address bus is connected between the two kits.
3. The CRO is connected.
4. Execute the program and check for the output displayed at the CRO each time you
execute.
EVALUAVTION
INFERENCE:
RESULT
Thus an assembly language program for analog to digital conversion i.e., to obtain a
square wave and triangular wave using 8085 microprocessor was executed and the output was
verified.
PROGRAMMABLE CONTROLLERS
AIM
APPARATUS REQUIRED
ALGORITHM
PREREQUISITES:
THEORY
A7 A6 A5 A4 A3 A2 A1 A0
1 1 0 0 0 X X X
= C0 (Hex).
A7 A6 A5 A4 A3 A2 A1 A0
1 1 0 0 0 X 1 X
= C2 (Hex).
A7 A6 A5 A4 A3 A2 A1 A0
1 1 0 0 0 X 0 X
=C0 (Hex).
The keyboard section of the 8279 interfacing module consists of 16 keys, besides two
keys for CNTL and SHIFT. With this keyboard it is possible to enter 64 different key codes.
Display is a 6-digit, multiplexed display. The decoded outputs are used to drive the
cathodes of the seven segment display. The output port lines A0-A3, B0-B3 drive the anodes of
the seven segment display.
dp- Decimal point. 1-LED does not glow. 0-LED will glow.
Table below shows the correspondence between the data bus and output port bits of 8279.
Also, the segment relationships with these are given:
Data bus D7 D6 D5 D4 D3 D2 D1 D0
8279
A3 A2 A1 A0 B3 B2 B1 B0
Output
Segments D c b a dp g f e
In order to light up a segment, the corresponding bit of the data written into the display
RAM should be 0.
0 0 0 D D K K K
0 0 0 1 0 0 0 0
= 10 (Hex).
1 1 0 0 1 1 0 0
= CC (Hex).
1 0 0 AI A A A A
1 0 0 1 0 0 0 0
= 90 (Hex).
PROGRAM
4105 MVI A,10 3E,10 The command word for set the
keyboard and display mode is
10(H)
EVALUAVTION
INFERENCE:
RESULT
Thus an assembly language program using 8051 microcontroller to accept a key from the
keyboard and display it in the display is executed and the output is verified.
To write a program to interface programmable interval timer (8253) and USART (8251)
with 8085
APPARATUS REQUIRED
1. The value 36H to load into the accumulator and send through output port of 8253. The
control word of 8253 is written as 36H which indicates the timer is operates in mode 3.
2. Load LSB and MSB count value 0A and 00 into the accumulator and send through output
port
3. Initialize the mode of operation of USART
4. Load the value 37H to accumulator to enable the transmit and enable bits and send
through output port of 8251
5. The value to be transmitted is loaded into the accumulator and send through output port
6. The transmitted data is received from the output port of 8251
7. The received data is stored in the memory
THEORY
The 8251A is used as a peripheral device for serial communication and is programmed by
the CPU to operate using virtually any serial data transmission technique. The USART accepts
data characters from the CPU in parallel format and then converts them into a continuous serial
data stream for transmission. Simultaneously, it can receive serial data streams and convert them
into parallel data characters for the CPU.
The 8251 is selected with address,
1 1 0 0 0 X X X
Since the address line A1 is connected to control/data input(C/D) of 8251,the control register of
8251 is selected when,
1 1 0 0 0 0 1 X
=C2 (Hex)
and the data register is selected with the address,
1 1 0 0 0 0 0 X
=C0 (Hex)
The two address lines A1 and A2 are connected to the pin A0(Pin 19) and (Pin 20) of 8253
respectively. Thus the I/O address for control register, Channel 0, Channel 1 and Channel 2 are
A7 A6 A5 A4 A3 A2 A1 A0 HEX
CONTROL REG. 1 1 0 0 1 1 1 0 CE
CHANNEL 0 1 1 0 0 1 1 0 0 C8
CHANNEL 1 1 1 0 0 1 1 1 0 CA
CHANNEL 2 1 1 0 0 1 1 0 0 CC
The control word 37H enables the transmit enable and receive enable bits, forces DTR output to
zero, resets the error flags, and forces RTS output to zero..
PROGRAM
4205 RST 1 CF
EXECUTION
INPUT OUTPUT
ADDRESS VALUE ADDRESS VALUE
EVALUAVTION
INFERENCE:
RESULT
Thus the program for interfacing 8253 and 8251 with 8085 microprocessor is performed
and the data is transmitted and received.
The Intel MCS-51 (commonly referred to as 8051) is a Harvard architecture, single chip
microcontroller (C) series which was developed by Intel for use in embedded systems.
The 8051 architecture provides many functions in a single package. It consists of,
One particularly useful feature of the 8051 core was the inclusion of a Boolean
processing engine which allows bit-level Boolean logic operations to be carried out directly and
efficiently on select internal registers and select RAM locations. This advantageous feature
helped cement the 8051's popularity in industrial control applications because it reduced code
size by as much as 30%. Another valued feature is the inclusion of four bank selectable working
register sets which greatly reduce the amount of time required to complete an interrupt service
routine. These registers also allowed the 8051 to quickly perform a context switch which is
essential for time sensitive real-time applications.
The MCS-51 UARTs make it simple to use the chip as a serial communications interface.
External pins can be configured to connect to internal shift registers in a variety of ways, and the
internal timers can also be used, allowing serial communications in a number of modes, both
synchronous and asynchronous. Some modes allow communications with no external
components.
Once a UART, and a timer have been configured, the programmer needs only to write a
simple interrupt routine to refill the send shift register whenever the last bit is shifted out by the
UART and/or empty the full receive shift register. The main program then performs serial reads
and writes simply by reading and writing 8-bit data to stacks.
MCS-51 based microcontrollers typically include one or two UARTs, two or three timers,
128 or 256 bytes of internal data RAM), up to 128 bytes of I/O, 512 bytes to 64 kB of internal
program memory, and sometimes a quantity of extended data RAM (ERAM) located in the
external data space. The original 8051 core ran at 12 clock cycles per machine cycle, with most
instructions executing in one or two machine cycles. With a 12 MHz clock frequency, the 8051
could thus execute 1 million one-cycle instructions per second or 500,000 two-cycle instructions
per second. Enhanced 8051 cores are now commonly used which run at six, four, two, or even
one clock per machine cycle, and have clock frequencies of up to 100 MHz, and are thus capable
of an even greater number of instructions per second.
MEMORY ARCHITECTURE
The MCS-51 has four distinct types of memory internal RAM, special function
registers, program memory, and external data memory.
Internal RAM (IRAM) is located from address 0 to address 0xFF. Special function
registers (SFR) are located from address 0x80 to 0xFF, and are accessed directly using the same
instructions as for the lower half of IRAM. Some of the SFR's are also bit-addressable.
External data memory (XRAM) also starts at address 0. It can also be on or off-chip. It
must be accessed using the MOVX (Move external) instruction. Many variants of the 8051
include the standard 256 bytes of IRAM plus a few KB of XRAM on the chip. If more XRAM is
required by an application, the internal XRAM can be disabled, and all MOVX instructions will
fetch from the external bus.
Memory:
Software:
Input : 230V AC @ 50 Hz
Output : +5 Volts / 1 Amp
Accessories:
Windows based debugger software.
PROGRAM EXECUTION
To execute a program, the microcontroller should be directed to the starting address of
the program. The microcontroller begins the execution of the program by following the first
machine code. The controller decodes the code by matching it with its predefined set of
instructions and performs the specified task. Fetching, decoding and performing the task are
continued one after the other and sequentially till the controller is instructed to halt. To encode a
program stored in specified set of memory locations the procedure adopted are as follows:
The program is entered through the Keyboard which is interfaced with the
microprocessor kit.
PRERQUISITES:
1. What are the major components of 8051?
2. What is the role of DPTR?
3. -------------- instruction is used to perform multiplication operation
4. instruction is used to perform division operation
5. Where will quotient and remainder get stored during division operation?
6. What is the use of SJMP?
7. Name some applications of 8051
1. ADDITION
ALGORITHM
1. Start the program
2. Get the first operand in accumulator
3. Add second operand with first operand in accumulator
4. Move data from accumulator to data pointer
5. Store the result in memory
6. Stop the program
FLOWCHART:
PROGRAM
EXECUTION
INPUT OUTPUT
ADDRESS VALUE ADDRESS VALUE
2. SUBTRACTION
ALGORITHM
1. Start the program
2. Get the first operand in accumulator
3. Subtract the second operand from first operand in accumulator
4. Move data from accumulator to data pointer
5. Store the result in memory
6. Stop the program
PROGRAM
EXECUTION
INPUT OUTPUT
ADDRESS VALUE ADDRESS VALUE
3. MULTIPLICATION
ALGORITHM
1. Start the program
2. Get the multiplier in A register
3. Get the multiplicand in B register
4. Multiply accumulator content and B register content
5. Store the result in memory
6. Stop the program
FLOWCHART:
PROGRAM
EXECUTION
INPUT OUTPUT
ADDRESS VALUE ADDRESS VALUE
4. DIVISION
ALGORITHM
1. Start the program
2. Get the multiplier in A register
3. Get the multiplicand in B register
4. Multiply accumulator content and B register content
5. Store the result in memory
6. Stop the program
PROGRAM
EXECUTION
INPUT OUTPUT
ADDRESS VALUE ADDRESS VALUE
EVALUAVTION
INFERENCE:
RESULT:
Thus the basic arithmetic and logical operations using 8051was studied.
AIM:
To find the sum of elements in an array using stack and call option.
APPARATUS REQUIRED
1. 8051 microcontroller kit
2. Key board
1. Stack Operation:
ALGORITHM:
1. Start
2. Move the data to DPTR
3. Move the data to accumulator
4. Adjacent call 4200
5. Add A & R0
6. Move the 16 bit data from A to DPTR
7. Move the data to accumulator
8. Move the data to R0
9. Return to 4107
PROGRAM
EXECUTION
INPUT OUTPUT
ADDRESS VALUE ADDRESS VALUE
2. Call Operation:
ALGORITHM:
1. Start
2. Move the data to DPTR
3. Move the data to accumulator
4. Adjacent call 4200
5. Add A & R0
6. Move the 16 bit data from A to DPTR
7. Move the data to accumulator
8. Move the data to R0
9. Return to 4107
PROGRAM
EXECUTION
INPUT OUTPUT
ADDRESS VALUE ADDRESS VALUE
EVALUAVTION
INFERENCE:
RESULT
Thus the program sum of elements using stack and call operations were executed.
AIM:
PREREQUISITES:
1. What is stepper motor?
2. How to reverse the rotation of stepper motor?
3. What is step angle?
4. What do you mean by half stepping and full stepping stepping?
THEORY:
A motor in which the rotor is able to assume only discrete stationary angular position is a
stepper motor. The rotary motion occurs in a step-wise manner from one equilibrium position to
the next. Stepper Motors are used very wisely in position control systems like printers, disk
drives, process control machine tools, etc.
The basic two-phase stepper motor consists of two pairs of stator poles. Each of the four
poles has its own winding. The excitation of any one winding generates a North Pole. A South
Pole gets induced at the diametrically opposite side. The rotor magnetic system has two end
faces. It is a permanent magnet with one face as South Pole and the other as North Pole.
The Stepper Motor windings A1, A2, B1, B2 are cyclically excited with a DC current to
run the motor in clockwise direction. By reversing the phase sequence as A1, B2, A2, B1,
anticlockwise stepping can be obtained.
In this scheme, any two adjacent stator windings are energized. The switching scheme is
shown in the table given below. This scheme produces more torque.
ANTICLOCKWISE CLOCKWISE
STEP A1 A2 B1 B2 DATA STEP A1 A2 B1 B2 DATA
1 1 0 0 1 9h 1 1 0 1 0 Ah
2 0 1 0 1 5h 2 0 1 1 0 6h
3 0 1 1 0 6h 3 0 1 0 1 5h
4 1 0 1 0 Ah 4 1 0 0 1 9h
The 74138 chip is used for generating the address decoding logic to generate the device
select pulses, CS1 & CS2 for selecting the IC 74175.The 74175 latches the data bus to the
stepper motor driving circuitry.
Stepper Motor requires logic signals of relatively high power. Therefore, the interface
circuitry that generates the driving pulses use silicon darlington pair transistors. The inputs for
the interface circuit are TTL pulses generated under software control using the Microcontroller
Kit. The TTL levels of pulse sequence from the data bus is translated to high voltage output
pulses using a buffer 7407 with open collector.
BLOCK DIAGRAM:
8051
8255 DRIVER CIRCUIT STEPPER MOTOR
MICROCONTROLLER
PROGRAM :
ADDRESS LABEL OPCODE OPERAND COMMENTS
ORG 4100h
PROCEDURE:
1. Enter the above program starting from location 4100.and execute the same.
2. The stepper motor rotates.
3. Varying the count at R4 and R5 can vary the speed.
4. Entering the data in the look-up TABLE in the reverse order can vary direction of
rotation.
EVALUAVTION
INFERENCE:
RESULT:
Thus a stepper motor was interfaced with 8051 and run in forward and reverse directions
at various speeds.
Microcontroller PIC16F877A is one of the PIC Micro family microcontrollers which is popular
at this moment, start from beginner until all professionals. Because of its user friendly nature and
use of flash memory technology where programs can be read and written thousand times.
PIC16F877A has 40 pins in which 33 are I/O pins. Hence PIC16F877A perfectly fits in to many
uses, from automotive industries and controlling home appliances to industrial instruments,
remote sensors, electrical door locks and safety devices. It is also ideal for smart cards as well as
for battery supplied devices because of its low consumption.
EEPROM memory makes it easier to apply microcontrollers to devices where permanent storage
of various parameters is needed (codes for transmitters, motor speed, receiver frequencies, etc.).
Low cost, low consumption, easy handling and flexibility make PIC16F877A applicable even in
areas where microcontrollers had not previously been considered (example: timer functions,
interface replacement in larger systems, coprocessor applications, etc.).
In System Programmability of this chip (along with using only two pins in data transfer) makes
possible the flexibility of a product, after assembling and testing have been completed. This
capability can be used to create assembly-line production, to store calibration data available only
after final testing, or it can be used to improve programs on finished products.
PIC Microcontroller MCU from Microchip Company divided into 4 large families. Each families
has a variety of components that provide built-in special features.
Evolution of PIC
With six variants ranging from 3.5K-14K bytes of Flash memory, up to 256 bytes of RAM and a
mix of peripherals including USART, CCP and onboard and comparators. These devices are well
suited for designers with applications that need more code space or I/O than 14-pin variants
supply, and are looking to increase system performance and code efficiency by employing
hardware motor control and communications capability.
PIC ARCHITECTURE:
APPARATUS REQUIRED
PRERQUISITES:
1. ADDITION:
ALGORITHM:
FLOWCHART:
PROGRAM:
main
var1, var2
addwf var2,w
END
OUTPUT:
2. SUBRACTION:
ALGORITHM:
FLOWCHART:
PROGRAM:
A AND B TWO 16 BIT NUMBERS
(AH:AL)-(BH:BL)=(AH:AL)
main
SUBTRACT:
MOVF BL,W
SUBWF AL,F
BTFSS STATUS,C
DECF AH,F
MOVF,W
SUBWF AH,F
END
OUTPUT:
3. MULTIPLICATION:
ALGORITHM
FLOWCHART:
PROGRAM:
main
movlw 0
bcf C
btfss n1,0
addwf n2,w
rlf n2,f
btfss n1,1
addwf n2,w
rlf n2,f
btfss n1,2
addwf n2,w
rlf n2,f
btfss n1,3
addwf n2,w
rlf n2,f
swapf n2,f
END
OUTPUT:
4. DIVISION:
ALGORITHM
FLOWCHART:
PROGRAM:
main
movwf Dividend
clrf Quotient
bcf STATUS, C
btfsc STATUS, Z
movf Dividend, w
btfsc STATUS, Z
goto Div3_Done
goto Div3_Loop
Div3_Done
return
END
OUTPUT:
EVALUAVTION
INFERENCE:
RESULT: