Professional Documents
Culture Documents
Prepared By Approved By
Mr.Ajith.B.Singh
Ms.M.Jayalaxmi HOD
Mr.K.Saravanakumar
REVISION 2018
Table of Contents
Date:
Objective : To write an ALP to sort N 8 bit elements stored in memory Location starting from
1300H using 8086 Microprocessor
APPARATUS :
Algorithm:
Is
Accumator content
> pointer of next
number?
Interchange contents
Decrement comparison counter
Is counter =0? No
Yes
No
Is counter =0?
Yes
End 1
Program:
MOV CL,0AH
Loop3 : MOV CH, 0AH
MOV BX,2000H
Loop 2: MOV AL,[BX]
INC BX
CMP AL,[BX]
JB Loop1
JE Loop1
MOV AH,[BX]
MOV [BX],AL
DEC BX
MOV [BX],AH
INC BX
Loop1:DEC CH
JNZ Loop2
DEC CL
JNZ Loop3
HLT
Input :
Memory Input
Location
4200 20
4201 55
4202 62
4203 23
4204 11
4205 85
4206 28
4207 69
4208 43
4209 69
Output:
Memory Input
Location
4200 11
4201 20
4202 23
4203 28
4204 43
4205 55
4206 62
4207 69
4208 69
4209 85
2
Result:
Thus, an ALP to sort N 8 bit elements stored in memory Location starting from 1300H using 8086
Microprocessor was executed successfully
1. Write an ALP to store the first number in 1200h memory location and the second
number in 1300h memory location. Store the sum of the two numbers in 1400h and also
calculate the difference, product, quotient and remainder in consecutive memory
locations from 1401h.
2. Write an ALP to store 16 bit Hexadecimal numbers starting from memory location 1200h
and to find the least number from the stored list and store in 1500h and 1501h
3. Write an ALP to store a 4 digit decimal number in memory location 110h and perform
the hexadecimal sum of individual digits and store the result in 1200h and 1201h
memory location.
4. Write an ALP to store N 8bit Hexadecimal number in consecutive memory locations
starting from 2000h. Find sum of all N element and store in 2100h and also find the
average and store in successive memory location.
5. Write an ALP to store a 8 bit hexadecimal number in memory location and convert into
decimal and find the sum of all natural numbers from 1 till the converted decimal
number.
Viva question:
3
Ex No.2
Date:
Objective : To write an Assembly Language Program to rotate the Stepper Motor in different
Speed
APPARATUS :
8086 Microprocessor kit with Keyboard and LCD display
Procedure:
1. Connect the 26 core FRC connector to the 8086 trainer at connector no CN4 and the
interface module.
2. Connect the power mate connector to the interface module and the other side of the
connector to the power supply. The connections to the power supply are given below.
connections: (power supply)
Black & Red: Gnd.
Blue & Green: +5V
3. 5- Way power mate is wired to the motor. This power mate is to be inserted into the
male socket provided on the interface. Care should be taken such that, below given code
for the particular colored wire coincides with the code on the interface.
A- GREEN
4
Algorithm:
Step 1 : Load the steps of stepper motor as input table using pointer DI
Step 2: Load the step count in register CL
Step 3: Move the content pointed by DI to accumulator and output the content to port connecting the
stepper motor interface
Step 4: Load DX register with the delay count and decrement to provide a delay in the output of
stepper motor
Step 5:Increment DI to point the next step value
Step 6: Decrement the step count and if not zero repeat from step 3
Step 7: Go to start.
Program:
START: MOV DI,2000H
OUT PORT1,AL
MOV DX,1010H
DELAY: DEC DX
JNZ DELAY
INC DI
DEC CL
JNZ L2
LOOP L1
JMP START
Result:
Thus, the speed of Stepper Motor is controlled by varying the delay and verified using 8086
Microprocessor
5
List of questions to be solved:
1. Write an ALP to run the stepper motor interfaced with 8086 at the desired speed in
Forward and Reverse direction.
2. Write an ALP to control conveyer belt using stepper motor using 8086 microprocessor.
Belt moves continuously at the rate of 1 step/sec, but steps for 5sec. When external
interrupt occurs then continue to move.
3. Write an ALP to control a stepper motor using 8086 at half step excitation sequence in
forward direction alone.
Viva question:
6
Ex No. 3 Assembly language Programming in 8051
Date:
Objective : To write an assembly language program to add, subtract, multiply and divide
two 8-bit & 16-bit numbers using 8051 microcontroller.
A
7
A
Stop
b) Subtraction
8
Program for Addition:
START CLR C
MOV A,#04
ADDC A,#05
MOV DPTR,#4500
MOVX @DPTR,A
STOP SJMP 4109
Program for Subtraction:
START CLR C
MOV A,#08
MOV R1,#04
SUBB A,R1
MOV DPTR,#4500
MOVX @DPTR,A
STOP SJMP 410A
Addition
Memory Input Subtraction
Location
Memory Input
4500 Location
4501 4550
Memory Output
Location
4501
Result:
Thus, an ALP to add & subtract two numbers using 8051 Microcontroller was executed successfully.
10
List of questions to be solved:
1. Write an ALP to generate a BCD up counter and send ach count value to memory
location 4500H to verify.
2. Write an ALP to store N hexadecimal numbers in consecutive memory location
starting from 4500H and to store an element x in memory location 4300H. Check
whether element x is available in the list of elements stored from 4500H. If yes, store
FFH in 4600H else 00H in 4600H.
3. Write an ALP to store a decimal number in memory location 4200H and to calculate the
factorial of the number in decimal and store in 4300H.
4. Write an ALP to transfer N 8 bit elements from one block of memory to another, i.e;
Move the elements stored in memory location starting from 4200H to 4300H
consecutively.
5. Write an 8051 ALP to copy a value from memory location 4500H into accumulator and
complement 70 times and find the equivalent decimal value.
Viva questions:
1. Why 8051 is called 8 bit microcontroller?
2. What is the width of data bus?
3. What is the width of address bus?
4. List out the features of 8051 micro controller?
5. How much on chip RAM is available?
6. What are the register set available in 8051?
7. Differentiate Microprocessor & Microcontrollers
8. What is the purpose of DPTR?
11
Ex No.4
Interfacing 8051 with ADC.
Date:
Objective :
To program starts from memory location 4100H. The program is executed for various
values of analog voltage which are set with the help of a potentiometer. The LED display is
verified with the digital value that is stored in the memory location 4150H.
APPARATUS
Microcontroller kit
ADC Interface board
THEORY
An ADC usually has two additional control lines: the SOC input to tell the ADC when to
start the conversion and the EOC output to announce when the conversion is complete. The
following program initiates the conversion process, checks the EOC pin of ADC 0419 as to
whether the conversion is over and then inputs the data to the processor. It also instructs the
processor to store the converted digital data at RAM 4200H.
ALGORITHM:
1. Select the channel and latch the address.
2. Send the start conversion pulse.
3. Read EOC signal.
4. If EOC =1 continue else go to step (3)
5. Read the digital output.
6. Store it in a memory location.
PROGRAM:
Program
INPUT OUTPUT
RESULT:
Thus, the analog voltage is varied using potentiometer and measured to store the
corresponding digital value.
DAC
1. Write an ALP to generate a saw tooth waveform by using DAC 0800 interfacing with 8051.
2. Write an ALP to generate a triangular waveform by using DAC 0800 interfacing with 8051.
ADC
1. Write an ALP to fetch the position from the potentiometer and store in memory location 4150H
using microcontroller 8051.
2. Write an ALP to measure analog voltage present across any terminal and displays the data using
ADC0809 converter IC interfacing with 8051.
Viva Questions:
1. What is transducer?
2. What is the form of the transducer output?
3. What is Preprocessing of transducer signals to be fed into an ADC called?
3. Explain signal conditioning and its role in data acquisition.
4. What is the purpose of ADC ?
5. How is ADC connected to 8051 ?
13
Ex No.5 Sensor Interfacing using 8051 Micro controller
Date:
Objective : To measure the temperature and store the digital value in memory using 8051
microcontroller.
APPARATUS :
8051 kit
ADC board
LM35 (temperature sensor)
Theory:
The LM35 series sensors are precision integrated-circuit temperature sensors, whose output
voltage is linearly proportional to the Centigrade temperature. It gives 10mV of output voltage
for every 10C. The LM35 does not require any external calibration or trimming to provide
typical accuracies of ±¼°C at room temperature and ±¾°C over a full -55 to +150°C temperature
range. The LM35's low output impedance, linear output, and precise inherent make
interfacing to readout or control circuitry especially easy. It can be used with single power
supplies, or with dual supplies. As it draws only 60 µA from its supply, it has very low self-
heating, less than 0.1°C in still air. The LM35 is rated to operate over a -55° to +150°C
temperature range. The LM35 IC sensor is available at a Low cost .LM35 is a three terminal IC
with ,Vcc ,Ground & Vout .
The LM 35 IC gives a 10mV analog output voltage for every degree Celsius change in
temperature. The Output of the temperature sensor is analog in nature so we need an analog
to digital converter for converting the analog input to its equivalent binary output.
14
Since the output of LM35 is analog voltage, it should be converted into digital before it is
applied to a microcontroller port pin.
Circuit:
Program:
MOV DPTR, #FFC8
MOV A,#10
MOVX @DPTR, A
MOV A,#18
MOVX @DPTR, A
MOV DPTR, #FFD0
MOV A,#01
MOVX @DPTR, A
MOV A,#00
MOVX @DPTR, A
MOV DPTR, #FFD8
WAIT MOVX A,@DPTR
JNB E0,WAIT
MOV DPTR,#FFC0
MOVX A,@DPTR
MOV DPTR,#4150
MOVX @DPTR, A
HERE SJMP HERE
15
INPUT : OUTPUT:
Temperature Value : 98 4150 : 62
Result:
Write an ALP to fetch the temperature continuously and store in consecutive memory
location starting from 4150H using microcontroller 8051.
Viva Questions:
16
Ex No.6 : Basic programming using ARM Processor.
Date:
Objective : To write a basic C program for LED interfacing with ARM LPC 2148 processor.
APPARATUS :
Procedure:
If it is 1
NO
YES
No
End
Y
17
Program:
#include <lpc 214x.h>
void delay();
void main()
{
PINSETL0 = 0x00000000;
IO0DIR = 0xFFFFFFFF;
while(1)
{
IOSET0 = 0xFFFFFFFF;
delay();
IOCLR0 = 0xFFFFFFFF;
delay();
}
}
void delay()
{
int i;
for(i=0;i<200;i++)
{
}
}
Output:
Result:
Thus, a C program for interfacing LED with Arm processor was executed successfully.
18
List of questions to be solved:
Viva questions:
19
Ex No.7 Interfacing with seven segment display using ARM
Date:
APPARATUS :
Description:
Operation – In a simple LED package common cathode SSD, there has 10 pin out of which 2 is
ground and rest is LED segments . Particular LED segment is glow(ON) by giving logic 1 to it
and rests at logic 0 .
So we need to program this 8 pin to display our number on SSD. In following table,
we convert this 8 pin s 8 bit binary data into hex code and shows the hex code of displaying
digits below.
Digit Hex code A B C D E F G
0 0x3F 1 1 1 1 1 1 0
1 0x06 0 1 1 0 0 0 0
2 0x5B 1 1 0 1 1 0 1
3 0x4F 1 1 1 1 0 0 1
4 0x66 0 1 1 0 0 1 1
5 0x6D 1 0 1 1 0 1 1
20
6 0x7D 1 0 1 1 1 1 1
7 0x07 1 1 1 0 0 0 0
8 0x7F 1 1 1 1 1 1 1
9 0x6F 1 1 1 1 0 1 1
Procedure:
If it is 1
NO
YES
Set the pins of LED port as array data. Call the delay
module
End Y
21
Program:
#include<LPC214X.h> // header file for lpc2148
int main()
{
PINSEL0=0X00000000; // select port0 as gpio mode
IO0DIR =0X000000FF; // make starting 8 pin as output and other as input of port0
while(1)
{
for(i=0;i<10;i++)
{
IO0SET =ar[i];
delay();
IO0CLR =ar[i];
}
}
return 0;
}
void delay()
{
for(j=0;j<1000;j++)
for(k=0;k<400;k++);
}
Output:
Result:
Thus, a C program for interfacing seven segment display with Arm processor was executed
successfully.
22
List of questions to be solved:
1. Write a C program to display the word GOOD in SSD using ARM7 processor and execute it.
2. Write a C program to display the current time in SSD using ARM7 processor.
Viva:
1. What is a port?
2. Name the exceptions supported by ARM7.
3. What are the comparison instructions in ARM7.
4. Define CPSR.
5. How to display F in a SSD?
23
Ex No.8 Basic Programming with Arduino Kit
Date:
APPARATUS :
Theory:
In this we use the built-in LED that most Arduino and Genuino boards have. This LED is
connected to a digital pin and its number may vary from board type to board type. To make your life
easier, we have a constant that is specified in every board descriptor file. This constant
is LED_BUILTIN and allows you to control the built-in LED easily. Here is the correspondence between
the constant and the digital pin.
D13 - 101
D13 - Due
D1 - Gemma
D13 - Intel Edison
D13 - Intel Galileo Gen2
D13 - Leonardo and Micro
D13 - LilyPad
D13 - LilyPad USB
D13 - MEGA2560
D13 - Mini
D6 - MKR1000
D13 - Nano
D13 - Pro
D13 - Pro Mini
D13 - UNO
D13 - Yún
D13 - Zero
If need to lit an external LED with this sketch, then build this circuit, where connect one end of the
resistor to the digital pin correspondent to the LED_BUILTIN constant. Connect the long leg of the LED
(the positive leg, called the anode) to the other end of the resistor. Connect the short leg of the LED (the
negative leg, called the cathode) to the GND. In the diagram below we show an UNO board that has D13
as the LED_BUILTIN value.
24
The value of the resistor in series with the LED may be of a different value than 220 ohm; the LED will
lit up also with values up to 1K ohm.
Schematic
25
Program:
void setup()
{
// initialize digital pin LED_BUILTIN as an output.
pinMode(LED_BUILTIN, OUTPUT);
}
Output
Result:
Thus, a C program for LED blinking using Arduino was executed successfully.
26
List of questions to be solved:
1. Write a C program to connect 4 LEDs and display 4 bit count value from 0000 to 1111 using
Arduino kit.
2. Write a C program to show the scrolling display by connecting 4 LEDs.
Viva:
27
Ex No.9 Design of a Traffic light controller with Arduino
Date:
Objective : To write a basic C program to design a traffic light controller system using arduino.
Apparatus :
Arduino UNO
KΩ Resistor X
Red LEDs X 4
Yellow LEDs X 4
Green LEDs X 4
Connecting wires
Prototyping board
Power adapter
Circuit Design:
Since the project is a traffic light controller, the circuit consists of many LEDs (12 as a
matter of fact) as we are implementing traffic lights at a 4 way intersection. The project is a
simple representation of traffic light controller and hence no other extra components are
used.
We need three LEDs of Red, Yellow and Green colors at each intersection. The
intersection is divided in to four lanes: Lane1, Lane 2 Lane 3 and Lane 4. All the LEDs are
connected to the Arduino UNO s digital I/O pins through respective current limiting resistors
of KΩ.All the co ectio s are ade as per the circuit diagra . The co plete wiri g diagra
of the circuit is shown below.
28
Program:
int Lane1[] = {13,12,11}; // Lane 1 Red, Yellow and Green
int Lane2[] = {10,9,8};// Lane 2 Red, Yellow and Green
int Lane3[] = {7,6,5};// Lane 3 Red, Yellow and Green
int Lane4[] = {4,3,2};// Lane 4 Red, Yellow and Green
void setup() {
for (int i = 0; i < 3; i++)
{
pinMode(Lane1[i], OUTPUT);
pinMode(Lane2[i], OUTPUT);
pinMode(Lane3[i], OUTPUT);
pinMode(Lane4[i], OUTPUT);
}
for (int i = 0; i < 3; i++)
{
digitalWrite(Lane1[i], LOW);
digitalWrite(Lane2[i], LOW);
digitalWrite(Lane3[i], LOW);
digitalWrite(Lane4[i], LOW);
}
}
void loop()
{
digitalWrite(Lane1[2], HIGH);
digitalWrite(Lane3[0], HIGH);
29
digitalWrite(Lane4[0], HIGH);
digitalWrite(Lane2[0], HIGH);
delay(7000);
digitalWrite(Lane1[2], LOW);
digitalWrite(Lane3[0], LOW);
digitalWrite(Lane1[1], HIGH);
digitalWrite(Lane3[1], HIGH);
delay(3000);
digitalWrite(Lane1[1], LOW);
digitalWrite(Lane3[1], LOW);
digitalWrite(Lane1[0], HIGH);
digitalWrite(Lane3[2], HIGH);
delay(7000);
digitalWrite(Lane3[2], LOW);
digitalWrite(Lane4[0], LOW);
digitalWrite(Lane3[1], HIGH);
digitalWrite(Lane4[1], HIGH);
delay(3000);
digitalWrite(Lane3[1], LOW);
digitalWrite(Lane4[1], LOW);
digitalWrite(Lane3[0], HIGH);
digitalWrite(Lane4[2], HIGH);
delay(7000);
digitalWrite(Lane4[2], LOW);
digitalWrite(Lane2[0], LOW);
digitalWrite(Lane4[1], HIGH);
digitalWrite(Lane2[1], HIGH);
delay(3000);
digitalWrite(Lane4[1], LOW);
digitalWrite(Lane2[1], LOW);
digitalWrite(Lane4[0], HIGH);
digitalWrite(Lane2[2], HIGH);
delay(7000);
digitalWrite(Lane1[0], LOW);
digitalWrite(Lane2[2], LOW);
digitalWrite(Lane1[1], HIGH);
digitalWrite(Lane2[1], HIGH);
delay(3000);
digitalWrite(Lane2[1], LOW);
digitalWrite(Lane1[1], LOW);
}
Result:
Thus, a traffic light controller using arduino kit was designed successfully.
30
Viva Questions:
31
Ex No.10 Design of a Simple chat Server using Arduino
Date:
Apparatus :
Circuit Design:
The Ethernet shield allows you to connect a WizNet Ethernet controller to the Arduino or
Genuino boards via the SPI bus. It uses pins 10, 11, 12, and 13 for the SPI connection to
the WizNet. Later models of the Ethernet shield also have an SD Card on board. Digital pin 4 is
used to control the slave select pin on the SD card.
The shield should be connected to a network with an ethernet cable. We have change the
network settings in the program to correspond to our network.
In the above image, the Arduino or Genuino board would be stacked below the Ethernet shield.
32
Schematic:
Program:
#include <SPI.h>
#include <Ethernet.h>
Result:
34
Viva Question:
1. What is Ethernet shield?
2. What are the components required to chat using arduino?
3. What are the header protocol files need to be included?
4. What is the purpose of DHCP protocol?
5. What is meant by SPI?
35