0% found this document useful (0 votes)
22 views40 pages

MCAlab (1) - Merged-1

The document is a practical record for the Microcontroller and its Applications Laboratory at SNS College of Technology for the academic year 2024-2025. It includes a list of experiments involving arithmetic operations using 8086 and 8051 microcontrollers, programming for LED and LCD displays using PIC microcontrollers, and interfacing with DAC and sensors using ARM processors. Each experiment outlines the aim, required apparatus, algorithms, and sample programs for execution.

Uploaded by

yogananth285
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views40 pages

MCAlab (1) - Merged-1

The document is a practical record for the Microcontroller and its Applications Laboratory at SNS College of Technology for the academic year 2024-2025. It includes a list of experiments involving arithmetic operations using 8086 and 8051 microcontrollers, programming for LED and LCD displays using PIC microcontrollers, and interfacing with DAC and sensors using ARM processors. Each experiment outlines the aim, required apparatus, algorithms, and sample programs for execution.

Uploaded by

yogananth285
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 40

SNS COLLEGE OF TECHNOLOGY

(AN AUTONOMOUS INSTITUTION)


COIMBATORE–641 035.

DEPARTMENT OF ELECTRICAL AND ELECTRONICS


ENGINEERING

19EEB303 MICROCONTROLLER AND ITS


APPLICATIONS LABORATORY
AcademicYear (2024-2025)

PRACTICAL RECORD

Name:
Reg. No:
Class:
Semester:
SNS COLLEGE OF TECHNOLOGY
(AN AUTONOMOUS INSTITUTION)
COIMBATORE – 641 035.

DEPARTMENT OF ELECTRICAL AND ELECTRONICS


ENGINEERING

19EEB303 MICROCONTROLLER AND ITS


APPLICATIONS LABORATORY

Name
Class Semester

Register No: ……………………….

Certified that this is the bonafide record of work done by the above student
oft the 19EEB303 Microcontroller and its Application
Laboratory during the academic year2024-2025(EVEN).

Signature of Lab In charge HoD / EEE

Submitted for practical examination held on

Internal Examiner External Examiner


LIST OF EXPERIMENTS

1 Arithmetic operations using 8086.

2 Arithmetic and bit manipulation operations using 8051

3 Programming of LED display using PIC

4 Programming of ADC interface using PIC

5 Programming of DAC Interface using ARM

Programming of Buzzer Relay and Temperature


6
Sensors using ARM

7 Miniproject using Arduino


S.
No DATE TITLE OF THE EXPERIMENT MARKS SIGN
.
ARITHMETIC OPERATIONS USING 8086

Ex. NO : 01
DATE :

16 BIT ARITHMETIC OPERATION OF 8086


MICROPROCESSOR
Aim: To write an assembly language program to perform arithmetic operations such asaddition,
subtraction, multiplication and division using two 16 bit numbers using 8086.

Apparatus required:

S.NO ITEM SPECIFICATION QUANTITY


1 MICROPROCESSOR 8086 KIT 1
KIT
2 POWER SUPPLY + 5 V DC 1
3 KEY BOARD 1

Algorithm:

16- bit Addition


• Get the first number is specific address.
• Add the second number to the first number.
• Add the two values.
• Store the sum and carry

16- bit Subtraction


• Initialize the MSBs of difference to 0
• Get the first number
• Subtract the second number from the first number.
• If there is any borrow, increment MSBs of difference by 1.
• Store LSBs of difference.
• Store MSBs of difference

16- bit Multiplication


• Get the multiplier.
• Get the multiplicand
• Initialize the product to 0.
• Product = product + multiplicand
• Decrement the multiplier by 1.
• If multiplicand is not equal to 0, repeat from step (d) otherwise store the product.

16- bit Division


• Get the dividend and divisor.
• Initialize the quotient to 0.
• Dividend = dividend–divisor
• If the divisor is greater, store the quotient
• Go to step 3
• If dividend is greater, quotient = quotient+ repeat from step 4.
Flowchart:

16-bit Addition 16-bit Subtraction

16- bit Multiplication 16-bit Division


ADDITION
ADDRESS OPCODE LABEL MNEMONICS COMMENT

MOV CX, 0000H Initialize counter CX

Get the first data in


MOV AX, [1200]
AX register.
Get the second data
MOV BX, [1202]
in B register.
Add the contents of
ADD AX, BX both the register AX
& BX

JNC 1010 Check for carry

If carry exists,
INC CX
incremen the CX

MOV [1206],CX Store the carry

MOV [1204], AX Store the sum

HLT Stop the program


SUBTACTION

ADDRESS OPCODE LABEL MNEMONICS COMMENTS

MOV CX, 0000H Initialize counter CX

Get the first data in AX


MOV AX, [1300]
register.
Get the second data in B
MOV BX, [1302]
register.
Sub the contents of both
SUB AX, BX
the register AX & BX

JNC 1010 Check for carry

If carry exists, incremen


INC CX
the CX

MOV [1306],CX Store the carry

MOV [1304], AX Store the sum

HLT Stop the program

MULTIPLCATION
ADDRESS OPCODE LABEL MNEMONICS COMMENT
MOV AX, 1234 Get the first data
in register.
MOV BX, 0100 Get the second
data in
BXregister.
MUL BX Multiply AX
& BX data
HLT Break point
DIVISION

ADDRESS OPCODE LABEL MNEMONICS COMMENT

MOV AX, [1200] Get the first data in


AXregister,
MOV DX, [1202] Get the second data
in DXregister.
MOV BX, [1204] Move ax register into
address
MOV [1206], AX Move the higher
order data
DIV BX The dividend byivisor

MOV AX, BX Copy the lower order


data
MOV [1208], AX Store the higher order
data.
HLT Stop the program.

Result:

Thus an assembly language program to perform arithmetic operations such as addition,


subtraction, multiplication and division using two 16 bit numbers using 8086 is performed and the result
is stored.
ARITHMETIC AND BIT MANIPULATION OPERATIONS USING
8051
Ex. NO : 02
DATE :

8 BIT ARITHMETIC & BIT MANIPULATION OPERATION OF


8051
Aim: To write an assembly language program to perform arithmetic operations such as addition,
subtraction, multiplication and division & Bit Manipulation operations using using 8051.

Apparatus required:

S.NO ITE SPECIFICATIO QUANTIT


M N Y
1 MICROCONTROLLER KIT 8051 KIT 1
2 POWER SUPPLY + 5 V DC 1
3 KEY BOARD 1

Algorithm:
• Initialise the microcontroller
• Add first data into data pointer
• Add the second data into a register
• Perform the arithmetic operations using the two values.
• Store the result using data pointer

8 Bit Addition:
MEMORY LOCATION OPCODE LABEL MNMONIC
4100 MOV A, #(data1)
4102 ADD A,#(data2)
4104 MOV DPTR,#4500
4107 MOVX @DPTR,A
4108 HERE SJMP(output address)
OUTPUT

INPUT
DATA1 DATA2 OUTPUT

8 Bit Subtraction:

MEMORY LOCATION OPCODE LABEL MNMONIC


4100 MOV A, #(data1)
4102 SUBB A,#(data2)
4104 MOV DPTR,#4500
4107 MOVX @DPTR,A
4108 HERE SJMP(output address)
OUTPUT

INPUT
DATA1 DATA2 OUTPUT

8 Bit Multiplication:

MEMORY LOCATION OPCODE LABEL MNMONIC


4100 MOV A, #(data1)
MOV B,,#(data2)
MUL AB
MOV DPTR,#4000
MOVX @DPTR,A
MOV A,B
MOVX @DPTR,A
HERE SJMP(output address)

OUTPUT

INPUT
DATA1 DATA2 OUTPUT

8 Bit DIVIDE:

MEMORY LOCATION OPCODE LABEL MNMONIC


4100 MOV A, #(data1)
MOV B,,#(data2)
MUL AB
MOV DPTR,#4000
MOVX @DPTR,A
MOV A,B
MOVX @DPTR,A
HERE SJMP(output address)
OUTPUT

INPUT
DATA1 DATA2 OUTPUT

Bit Manipulation Operation:


RESULT:
Thus an assembly language program to perform arithmetic operations such as addition,
subtraction, multiplication and division & Bit Manipulation operations using using 8051 is performed
and the result is stored.
PROGRAMMING OF LED DISPLAY USING PIC

Ex. NO : 03
DATE :

7 SEGMENT DISPLAY INTERFACING WITH PIC


MICROCONTROLLER
Aim: To interface a 7 segment display and display a number in the LED display using PIC
microcontroller.

Apparatus required:

S.NO ITE SPECIFICATION QUANTIT


M Y
1 PIC MICROCONTROLLER KIT PIC16F877A 1
2 POWER SUPPLY + 5 V DC 1
3 KEY BOARD 1
4 LED – BOARD 7 SEGMENT DISPLAY 1

Procedure:
• PIC microcontroller is initialized
• Connect the 7 segment display
• Input the numbe to be displayed in the LED
• Make the number present at the output of PIC
• Once the LED board is enabled, it is ready to get input from the PIC module
• The number is transferred to the 7 segment display board
• The number is displayed in LED display

Pin diagram of a 7 segment display & Hardware module


Circuit Connections of a 7 segment display – Enabling the Board

Final circuit setup of the LED display:


PROGRAM:-

#include <pic.h>
#define -XTAL-FREQ. 16000000
__CONFIG (OX3F72)
#define Seg PORT D
int a[10]={0x6F, OX7F, OXO7,OX7D, OX6D, 0X66, 0X47, 0x5B, 0x06, OX3F};
int main()
{
TRIS D OXOO
PORT D = 0X00
while (1)
{
for (int i=0, 1<10; i++)
{
seg: a[i];
__delay_ms(1000);
}
}
}
Output:

Result:

Thus a 7 segment display is interfaced with a PIC microcontroller and the number isdisplayed
in the LED display successfully.
PROGRAMMING OF LCD DISPLAY
USING PIC
Ex. NO : 04
DATE :

2x16 CHARACTER LCD DISPLAY INTERFACING WITH PIC


MICROCONTROLLER
Aim: To interface a 2x16 character LCD display and display a number in the LED displayusing
PIC microcontroller.

Apparatus required:

S.NO ITE SPECIFICATION QUANTIT


M Y
1 PIC MICROCONTROLLER KIT PIC16F877A 1
2 POWER SUPPLY + 5 V DC 1
3 KEY BOARD 1
4 LCD – BOARD 2x16 CHARACTER LCD 1

Procedure:
• PIC microcontroller is initialized
• Connect the 2x16 Character LCD
• Input the numbe to be displayed in the LCD
• Make the number present at the output of PIC
• Once the LCD board is enabled, it is ready to get input from the PIC module
• The number is transferred to the 7 segment display board
• The number is displayed in LCD display

Pin Diagram of 2x16 Character LCD display

Circuit Connections of a 2x16 Character LCD display – Enabling the Board:


PROGRAM:-
#include<pic.h>
__config (0X3F72);
#define _XTAL_FREQ 1600000
#define LCD PORT C
#define rs1 RD0
#define rs1 RD1
#define en1 RD2
char x[16]="Microcontroller";
void enable()
{
en 1=1;
__delay_ms(100);
en 1=0;
}
void cmd (int a)
{
rs1 = 0;
rw1 = 0;
lcd = a;
enable ();
}
void data (char b)
{
rs1 = 0;
rw1 = 0;
lcd = b;
enable ();
}
int main()
{
TRISC = 0X00;
TRISO = 0X00;
PORTD = 0X00;
PORTC = 0X00;
cmd(0X01);
cmd(0X0e);
cmd(0X38);
while(1)
}
{
for(int i=0;i<15;i++)
{
cmd(0XC0+i)
data(x[i]);
}
}
Output:

Result:

Thus a 2x16 Character display is interfaced with a PIC microcontroller and the numberis
displayed in the LCD display successfully.
Ex. No. : 05
Date :
DIGITAL TO ANALOG CONVERTER INTERFACING

Aim:

To interface and convert Digital to Analog using DAC in ARM processor.

Apparatus required:

S.NO ITEM SPECIFICATION QUANTITY


1 ARM processor EK-TM4C123GXL 1
2 Computer Energia software 1
3 Voltmeter / Multimeter (0-20)V 1
4 Connecting wires 1

Theory:

Digital scale value in program is uploaded to ARM processor. This value is passed to digital to
analog converting pin using analog write program line, so equivalent digital value is obtained at the
output of that pin. This is monitored by Voltmeter connected across the same pin with ground.

Procedure:

1. Connections are given as per the circuit diagram.


2. DAC energia program is loaded in ARM processor.
3. In circuit connect digital to analog pin to + terminal of voltmeter
4. Another end of voltmeter to be connected with ground.
5. Observe the respective analog voltage in voltmeter.

Circuit diagram:
PROGRAM:-

#include<lpc 214 x.h>


unsigned char sine[50]={52,57,62,66,70,74,77,80,82,84,85,86,86,86,85,83,81,78,
75,72,69,65,61,56,52,48,44,39,35,31,28,25,22,19,17,15,
14,14,14,15,16,18,20,23,26,30,34,38,43,48};
void delay_ms(double ms)
{
unsigned int i,j;
for (i=0;i<ms;i++)
for(j=0;j<1000;j++)
}
int main()
{
int i;
pinsel 0 = 0X00000000
pinsel 1 = 0X00000000
pinsel 2 = 0X00000000
100DIR = 0xff;
while(1)
{
for (i=0;i<50;i++)
{
100SET= sine[i];
delay_ms(10);
100CLR = sine[i];
}
}
}

Result:

Thus the Conversion of Digital to Analog is performed and verified with ARM processor
successfully
PROGRAMMING OF BUZZER RELAY AND TEMPERATURE SENSORS
USING ARM

Ex. NO: 06
DATE :

BUZZER RELAY AND TEMPERATURE


SENSORS

Aim: To write an embedded c program for Buzzer, Relay and Temperature Sensors UsingARM

Apparatus Required:

S.N ITEM SPECIFICATIO QUANTIT


O N Y
1 ARM KIT LPCXX KIT 1
2 POWER SUPPLY + 5 V DC 1
3 ARM IDE Keil Software 1

Programming of buzzer using ARM

Buzzer:

Buzzer is an electrical device, which is similar to a bell that makes a buzzing noise andis used
for signaling. Typical uses of buzzers and beepers include alarm devices, timers and confirmation of
user input such as a mouse click or keystroke.

Interfacing buzzer:

Fig. 1 shows how to interface the Buzzer to microcontroller. A piezoelectric element may be
driven by an oscillating electronic circuit or other audio signal source, driven with a piezoelectric
audio amplifier. Sounds commonly used to indicate that a button has been pressedare a click, a ring or a
beep. When the input port pin from microcontroller is changed, the soundwave is changed in Buzzer.

Fig. 1 Interfacing Buzzer to Microcontroller


PROGRAM:-

#include<lpc 214 x.h>


#include
#define BUZZ 7 void Delay(void);
void main(void);voidmain()
{
PINSEL 0 = 0X00;
{
10SETO = 1 <<BUZZ;
Delay();
10CLR0 = 1<<BUZZ;
Delay();
}
}
Void Delay()
{
unsigned int i,j;
for [i=0;i<1000;i++]
for [j=0;j<700;j++]
}

Relay Programming Of Relay Using ARM

Relays are devices which allow low power circuits to switch a relatively high Current/Voltage
ON/OFF. A relay circuit is typically a smaller switch or device which drives (opens/closes) an electric
switch that is capable of carrying much larger current amounts.

Interfacing Relays:

Fig. 2 shows how to interface the Relay to microcontroller. There are 2 input channels. Each
input is connected to the triggering coil of the respective relay. There are 2 output channels that each
correspond to an input. When the input is energized, the relay turns on and the '+' output is connected to
+12v. When the relay is off, the '+' output is connected to Ground. The '-' output is permanently wired
to Ground.

Fig. 2 Circuit Connection Relays


Temperature Sensor

DS1820 is a temperature sensor which is small sensor. The output of sensor converted to
digital that easy connecting with microcontroller.

Interfacing DS1820

Fig. 3 shows how to interface the DS1820 to microcontroller. As you can see the first pin is
connected to GND, the third pin is connected to VCC & the second pin is connected to the
Microcontroller. So when the temperature is sensing, it give the sensor reading to controller.

Fig-3 Pin connections of DS1820

Program:
#include
#include #define DONE
#define START 0x80000000
#define PRESET 0x01000000 void
Delay () 0x00230600
unsigned int i,j;
for (i=0;i<50;i++) for
(j=0;j<500;j++);
}
void Welcome ()
{
printf ("-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.\n\r");
printf (" Developed By : R&D Wing \n\r");
printf (" © 2009 Pantech Solutions Pvt Ltd \n\r");
printf (" \n\r");
printf ("*** Temperature Sensor Interfacing with Tyro Kit ***\n\r");printf
(" \n\r");
printf (">> Put Jumper J in 'E' Mode to Enable Temp Sensor Block \n\r");printf
(">> Connect UART1 to COM Port @ 9600 Baud Rate\n\n\r"); printf
("********************************************************\n\r");
printf ("************************* Result ***********************\n\r");
printf ("********************************************************\n\n\r");
}
void Serial_Init ()
{
PINSEL0 |= 0x00050000; //Configure TxD1 and RxD1 @ P0.8 & P0.9
U1LCR = 0x83;
U1DLL = 195;
U1LCR = 0x03;

}
void main ()
{
unsigned long Val;
{
VPBDIV = 0x02;
Serial_Init ();
PINSEL1 = 0x01 << 24;
Welcome ();
AD0CR = PRESET | 0x02;
AD0CR |= START;
while (1)
{
do
{
Val = AD0GDR;
}
while ((Val & DONE) == 0); //Check if
Conversion is DONE
Val = ((AD0GDR >> 6) & 0x3FF);
//Extract Result from Bits AD0GDR.15 - AD0GDR.6printf
(">> Current Temperature : %4d ", Val);
printf ("\xF8 \F \r");
}
}

RESULT:

Thus the embedded c program for Buzzer, Relay and Temperature Sensors Using Arm iscompiled
and verified using Arm.
MINI PROJECTS USING
ARDUINO
Ex. NO: 07
DATE :

Aim: To develop mini projects using Arduino Uno

Requiring Components
• Arduino board
• Arduino IDE
• USB cable
• Bread Board
• LEDs
• Connecting Wires
• Resisters
• Potentiometer
• 7 Segment display
• Motor Driver
• DC motor
• IR array Sensor
• Ultrasonic sensor
• Battery
LED Control

Challenges:

Challenge 1A : Blink LED Every one second


Challenge 1B : Multiple LEDs Blink once at a time
Challenge 1C : Multiple LEDs- Knight Riders Style
Challenge 1D : Color Brightness control using analogWrite() function
Challenge 1E : Arduino-Analog Output LED Dimming Using for Loop Structure

Challenge 1A : Blink LED Every one second


Challenge 1B : Multiple LEDs Blink once at a time

Challenge 1C : Multiple LEDs- Knight Riders Style


Challenge 1D : Color Brightness control using analogWrite() function

Led Controled By Push Button


Challenge 1E : Arduino-Analog Output LED Dimming Using for Loop Structure

Challenges:

Challenge 2A : LED ON When press any One push button at a time


Challenge 2B : LED ON when press all push button at a time Challenge
2C : LED ON when press at least 2 push button at a time

Potentiometer Value Measurement


LED Brightness Controlled From Potentiometer
PROGRAM FOR LED BRIGHTNESS CONTROL

MOTOR CONTROL:
Motor direction Control

Motor Speed control


Motor and Potentiometer Connected Arduino

Speed control:
Direction control:

Line array sensor test:

5V- Arduino 5V

GND – Arduino

GndS1- Arduino A3

S2- Arduino A2

S3- Arduino A1
Vcc- Arduino 5V Trig-Arduino 12
Echo- Arduino 13 GND- Ardunio
Gnd

Result:

You might also like