INDIAN INSTITUTE OF INFORMATION
TECHNOLOGY BHAGALPUR-813210
            SUBMITTED BY: SHEELAJ BABU
                ROLL NO:180101041(CSE)
                      SEMESTER:IV
   Department Of Electronics & Communication Engineering
             IIIT Bhagalpur,Bihar-813210,INDIA
     MICROPROCESSOR     &
              JAN-MAY-2020
    INTERFACINGS LAB
                       REPORT
                                                                 INDIAN INSTITUTE OF INFORMATION TECHNOLOGY [IIIT]
                                                                                   Bhagalpur-813210, Bihar, INDIA
                                                         DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
ss ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
                                                                  CERTIFICATE
   This is to certify that Mr. SHEELAJ BABU bearing Institute Roll No.
180101041 has satisfactorily completed the course in Microprocessor &
      interfacings (EC216) during the academic year 2020-2021.
     DATE :22/05/2020
    PLACE:IIIT,BHAGALPUR
                                                                                                                  Dr. Suraj
                                                                                                            Assistant Professor,(ECE)
                                                                                                            IIIT, Bhagalpur-813210
contents:-
                                                                                  2
                                       EXPERIMENT- 01
Toggle LEDs connected at Port P1.                                                            9
  1.1 AIM :                                                                                  9
  1.2 Program :                                                                              9
  1.3 Hex Code:                                                                              9
  1.4 Simulated Output:                                                                  10
  1.5 Conclusion                                                                         10
                                         EXPERIMENT- 02
 Toggle LEDs connected to the port P1, from right to left, keeping previous LEDs off.   11
  2.1 AIM :                                                                              11
  2.2 Program :                                                                          11
  2.3 Hex Code:                                                                          12
  2.4 Simulated Output:                                                                  12
  2.5 Conclusion                                                                         12
                                               EXPERIMENT- 03
  Toggle LEDs connected to the port P1, from left to right, keeping previous LEDs on.    13
                                                          3
3.1 AIM :                                                                       13
  3.2 Program :                                                                  13
  3.3 Hex Code                                                                        9
  3.4 Simulated Output:                                                                   9
  3.5 Hardware interfaced output:                                                     10
  3.6 Conclusion                                                                      10
                                            EXPERIMENT- 04
Toggle LED with delay of 500 ms connected at port P1.1: Use of Software delay         10
  4.1 AIM :                                                                          10
  4.2 Program :                                                                      10
  4.3 Hex Code                                                                       11
  4.4 Simulated Output:                                                              11
  4.5 Conclusion                                                                     12
                                            EXPERIMENT- 05
Hardware delay using timer 0 in mode 1                                               18
                                                        4
  5.1 AIM :                                                       18
5.2 Program :                                                 18
  5.3 Hex Code                                                18
  5.4 Simulated Output:                                           19
  5.5 Conclusion                                                  19
                                            EXPERIMENT- 06
Hardware delay using timer 0 in mode 2                        20
  6.1 AIM :                                                       20
6.2 Program                                                  20
6.3 Hex Code                                                 20
  6.4 Simulated Output:                                       21
  6.5 Conclusion                                              21
                                   EXPERIMENT- 07
Hardware delay using interrupt (use auto-reload mode)                  22
  7.1 AIM :                                                  22
                                                        5
  7.2 Program                                                    22
  7.3 Hex Code                                                   23
  7.4 Simulated Output:                                          23
  7.5 Hardware interfaced output:                                23
  7.6 Conclusion                                                 24
                                       EXPERIMENT- 08
  Generation of PWM wave of specified frequency and duty cycle   25
  8.1 AIM :                                                      25
  8.2 Program                                                    25
  8.3 Hex Code                                                   26
  8.4 Simulated Output:                                          26
  8.6 Conclusion                                                 26
                                             EXPERIMENT- 09
Display 0 to 9 using seven segment display                       15
                                                      6
  9.1 AIM :                                                  15
  9.2 Program                                                15
  9.3 Hex Code                                               15
  9.4 Simulated Output:                                      16
  9.5 Hardware interfaced output:                            16
  9.6 Conclusion                                             17
                                            EXPERIMENT- 10
Design of digital voltmeter: Application of ADC              15
  10.1 AIM :                                                 15
  10.2Program                                                15
  10.3 Hex Code                                              15
  10.4 Simulated Output:                                     19
  10.5 Hardware interfaced output:                           16
  10.6 Conclusion                                            17
                                           EXPERIMENT- 11
 Interfacing of servo motor                                  15
                                                  7
11.1 AIM :                                                15
11.2Program                                               15
11.3 Hex Code                                             15
11.4 Simulated Output:                                    19
11.5 Hardware interfaced output:                          16
11.6 Conclusion                                           17
                   -:Toggle LEDs connected at Port P1:-
                                    8
1.1 AIM :
Toggle the LEDs connected at alternate pin of the port P1.
1.2 PROGRAM:
// Header:-Simple on-off blinking
// Author:SHEELAJ BABU
// Date:17-jan-2020
#include <reg51.h>// including register header file
void main()
unsignedint index;// defining running variable
while(1)// super loop
P0=0x55;// initializing register
for(index=0;index<10000;index++);// delay
P0=0xAA;// shifted register value
for(index=0;index<10000;index++);// delay
1.3 HEX CODE:
:03000000020827CC
:0C082700787FE4F6D8FD75810702080018
:10080000758055E4FFFE0FBF00010EBE27F8BF1034
:10081000F57580AAE4FEFFC3EF9410EE942750E034
:070820000FBF00010E80F084
:00000001FF
                                                     9
1.4 SIMULATED OUTPUT:
1.5 CONCLUSION:
Thus We Have got Simple on off blinking is implemented using (01010101) 2=(55)16
and (10101010)2=(AA)16 .
        -:Toggle LEDs connected to the port P1, from right to left,
                                            10
                                keeping previous LEDs off :-
2.1 AIM :
Right to left blink shifting with the use of shifting operator and previous LEDs off.
2.2 PROGRAM :
// Header: Right to left blink shifting
// Author: SHEELAJ BABU
// Date: 03-Feb-2020
#include <reg51.h>
void delay()//Function for creating Delay.
unsignedint index1,index2;//Declaring Variables.
for( index1=0;index1<200;index1++)// Nested loop for Creating Delsy
for(index2=0;index2<10000;index2++);
void main()
unsignedint index;//Declaring running Variable
while(1)//Infinite while Loo1
P1=0x01;
for(index=0;index<7;index++)//Repeating the loop 7 times for each Led.
delay();//Calling Delay
P1=P1<<1;//Shifting the Value one bit to left.
delay();//Calling Delay
2.3 HEX CODE:
                                                   11
 :0300000002083CB7
 :0C083C00787FE4F6D8FD75810702080003
 :10081F00E4FFFEE4FDFC0DBD00010CBC27F8BD108C
 :0C082F00F50FBF00010EEF64C84E70E72B
 :01083B00229A
 :10080000759001E4FBFA12081FE59025E0F59012BF
 :0F081000081F0BBB00010AEB64074A70E980E187
 :00000001FF
2.4 SIMULATED OUTPUT:
2.5 CONCLUSION:
So in this experiment we have to (Right to left) blink shifting is implemented.The idea of using for loop is
clearly now .
                                                       12
-: Toggle LEDs connected to the port P1, from left to right,
                keeping previous LEDs on.:-
3.1 AIM:
left to right blink shifting with the use of shifting operator and previous LEDs on.
3.2 PROGRAM:
// Header: Left to Right blink shifting with previous led on
// Author: SHEELAJ BABU
// Date: 10-Feb-2020
#include <reg51.h>
void delay()//Function for creating Delay.
unsignedint index1,index2;//Declaring Variables.
for( index1=0;index1<200;index1++)// Nested loop for Creating Delsy
for(index2=0;index2<10000;index2++);
void main()
unsignedint index;//Declaring running Variable
while(1)//Infinite while Loo1
P1=0x80;
for(index=0;index<7;index++)//Repeating the loop 7 times for each Led.
delay();//Calling Delay
P1=(P1>>1)+0x80;//Shifting the Value one bit to right keeping previous led on.
delay();//Calling Delay
                                                   13
3.3 HEX CODE:
:0300000002083EB5
:0C083E00787FE4F6D8FD75810702080001
:10082100E4FFFEE4FDFC0DBD00010CBC27F8BD108A
:0C083100F50FBF00010EEF64C84E70E729
:01083D002298
:10080000759080E4FBFA120821E590C3132480F56B
:10081000901208210BBB00010AEB64074A70E780C5
:01082000DFF8
:00000001FF
3.4 SIMULATED OUTPUT:
                                          14
3.5 HARDWARE INTERFACED OUTPUT:
3.6 CONCLUSION:
In this experiment we have implemented Left to Right blink shifting with previous led
on.
                                           15
     -:Toggle LED with delay of 500 ms connected at
           port P1.1: Use of Software delay:-
4.1 AIM:
    Toggle LED with delay of 500ms connected at p1.1:-using software delay.
4.2 PROGRAM :
// Header: Specified delay by software
// Author: SHEELAJ BABU
// Date: 03-Feb-2020
#include <reg51.h>// including register header file
void main()
unsignedint index;// defining running variable
while(1)// super loop
P1=0x02;// Setting p1.1
for(index=0;index<3000;index++);// delay
P1=0x00;// negates p1.1    value(reset p1.1)
for(index=0;index<1500;index++);// delay
4.3 HEX CODE:
:03000000020828CB
:0C082800787FE4F6D8FD75810702080017
:10080000759002E4FFFE0FBF00010EE4B507F7EE9E
:10081000B47DF3E4F590FEFFC3EF9480EE943E5078
:08082000DF0FBF00010E80F0A4
:00000001FF
                                               16
4.4 SIMULATED OUTPUT:
Wave Made BY 500ms Delay:-
4.5 CONCLUSION:
Port output confirms that led is toggling . Further delay is measured which is 500ms. So
required condition is successfully completed.
             -: Hardware delay using timer 0 in mode-1:-
                                              17
5.1 AIM :
To generate square wave using delay of timer 0 in mode 1
5.2 ASSEMBLY PROGRAM :
// Header: Hardware delay delay using timer 0 mode 1
// Author:SHEELAJ BABU
// Date: 1-May-2020
//org0h
MOV TMOD,#01H; Configuring TMOD register to timer 0 in mod 1
myLabel:MOV TH0,#87H; Setting TH0
MOV TL0,#0CEH; Setting TL0
    ACALL Suraj; Calling Delay subroutine
    SJMP myLabel; Short jump on to location mylabel
Suraj:
SETB TR0                 ; Starting Timer tick
here:JNB TF0,here        ; Jump on not bit
    CPL P1.1                 ; Complement P1.1
    CLR TF0                  ; Reset TF0
    CLR TR0                  ; Reset TR0
RET; Return
END;End of Program
5.3 HEX CODE:
      :10000000758901758C87758ACE110D80F6D28C307A
      :090010008DFDB291C28DC28C225B
      :00000001FF
5.4 SIMULATED OUTPUT:
                                             18
5.5 CONCLUSION:-
In This experiment the Square wave is generated with 50% duty cycle using delay of timer 0
in mod 1.
         -: Hardware delay using timer 0 in mode 2:-
                                            19
6.1 AIM :
To generate square wave using delay of timer 0 in mode 2.
6.2 ASSEMBLY PROGRAM:
// Header: Hardware delay using timer 0 mode 2
// Author:SHEELAJ BABU
// Date: 01-May-2020
MOV TMOD,#02H;set timer 0 in mod 2
AGAIN:MOV TH0,#0FFH;loads count value
SETB TR0;starts timer 0
BACK:JNB TF0,BACK//check for over flow
      CLR TR0
      CPL P2.3;negates port value
      CLR TF0
      SJMP AGAIN
END
6.3 HEX CODE:
:10000000758902758CFFD28C308DFDC28CB2A3C273
:030010008D80F0F0
:00000001FF
6.4 SIMULATED OUTPUT:
                                            20
Port output to check square bit is fluctuating or not for the confirmation of production of
square wave.
Timer out to check wether timer 0 in auto reload mode is set up or not.
HERE > Square wave with 50% duty cycle:—
6.5 CONCLUSION:-
Finally the Square wave is successfully generated with 50% duty cycle using delay of timer 0
in mod 2.
      -: Hardware delay using interrupt (use auto-reload
                                              21
                                                    mode):-
7.1 AIM        :
Write an ALP that continuously read 8 bit data from Port 2 and send the data to Port 0.At the same time it
should generate square wave 0f 500 micro seconds period on pin P1.0.Assume crystal frequency is 11.0592
MHz.
             Interrupt                                Vector Location
       --------------------------------------------------------------------------
           ~INT0                                       0003H
             TF0                                       000BH
            INT1                                       0013H
7.2 ASSEMBLY PROGRAM:
// Header: Hardware delay using timer 1 mode 2
// Author:SHEELAJ BABU
// Date: 01-May-2020
ORG0000H
MOV P1,#00H;makes all bits of port 1, 0
LJMP MAIN                  ;jump to main lable
ORG001BH; ISR for timer 1 interrupt
        CPL P1.0               ;Complement P1.0 bit
        CLR TF1                ; Clear TF1
        RETI                   ;Return from ISR
;//ORG 0040H;Start main program after interrupt vector table
MAIN:MOV TMOD,#20H;Timer 1 in mode 2
MOV P2,#0FFH;Configure Port 2 as input
MOV TH1,#1AH;Calculated as per the question
;//MOV IE,#88H;Enable timer 1 interrupt
MOV IE,#88H;enables ET1 and EA
SETB TR1                 ;Start timer 1
BACK:MOV A,P2;Read data from P2
MOV P0,A;Send data on P0
               SJMP BACK       ;Repeat
END
                                                           22
7.3 HEX CODE:
:06000000759000020020D3
:10001B00B290C28F3275892075A0FF758D1A75A8A5
:09002B0088D28EE5A0F58080FA70
:00000001FF
7.4 SIMULATED OUTPUT:
Port output to check square bit is fluctuating or not for the conformation of production of square wave.
Port 2 and port 0 data:
Timer output:
                                                     23
Interupt peripheral output:
Square wave with a specified time period of 500ms.
7.5 CONCLUSION:-
In this experiment the Square wave of specified time period 500 micro sec is generated with
50% duty cycle using timer 1 in auto reload mode.Also port 2 ad 0 data are same which
confirms that data from port2 is read and sended to port 0 succesfully.
Timer peripherals further confirms that timer 1 is used in auto reload mode(mode
2).Interupt peripheral shows that interrupt is enabled.
                                            24
    -:Generation of PWM wave of specified frequency and duty
                           cycle:-
8.1 AIM :Generate a PWM Wave                 of 14.68Hz and 70% duty cycle at P1.1 .
8.2 PROGRAM:
// Header: Pwm wave with specified duty cycle and frequency.
// Author: SHEELAJ BABU
// Date: 06-May-2020
# include <reg51.h>
int index=0;
sbit x =P1^1;
void main()
TMOD =0x01;//sets timer 0 in   mode 1
IE=0x82;// globally enables the interupts and makes ET0=1
TL0=0xE1;//loads timer value to get desired delay
TH0=0X0A;//loads timer value to get desired delay
TR0=1;//makes timer 0 on
x=1;//sets x
while(1)//infinite loop
if(index==70)//condition for on period
x=0;
if(index ==100)// condition for off period
x=1;
index=0;
Void isr(void) interrupt 1// interupt service routine
index++;//increments x
                                                        25
}
8.3 HEX CODE:
:03000000020800F3
:0C080000787FE4F6D8FD758109020847F6
:0408C3000208000027
:10088C0075890275A882758AE1758C0AD28CD29111
:10089C00E509644645087002C291E509646445089F
:0A08AC0070EED291F508F50980E620
:03000B000208B632
:0D08B600C0E00509E50970020508D0E03238
:10080C0002088CE493A3F8E493A34003F68001F26E
:10081C0008DFF48029E493A3F85407240CC8C333ED
:10082C00C4540F4420C8834004F456800146F6DFBC
:10083C00E4800B01020408102040809008C3E47E81
:10084C00019360BCA3FF543F30E509541FFEE493B1
:10085C00A360010ECF54C025E060A840B8E493A378
:10086C00FAE493A3F8E493A3C8C582C8CAC583CAA3
:10087C00F0A3C8C582C8CAC583CADFE9DEE780BE5B
:0108C7000030
:00000001FF
8.4 SIMULATED OUTPUT:
Below the PWM wave:
8.5 CONCLUSION:
In this experiment we have ,Pwm wave is successfully generated with 14.68Hz frequency and
70% duty cycle. Further fluctuating port1.1 output confirms the generation of pwm wave.
                                           26
        -: Display 0 to 9 using seven segment display:-
9.1 AIM :
Program to display 0 to 9 using seven segment display .
9.2 PROGRAM:
//AUTHOR-SHEELAJ BABU
//ROLL-180101041
//BRANCH-CSE
#include<reg51.h>
sbit x=P2^7;
sbit y=P2^6;
sbit z=P2^5;
void delay(void);
unsigned int i,j,seg=0;
void main()
{
unsigned char
disp[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};
while(1)
{
k:
if(seg==0)
{
x=0;
y=0;
z=0;
}
if(seg==1)
{
x=0;
y=0;
z=1;
}
if(seg==2)
{
x=0;
y=1;
z=0;
}
if(seg==3)
{
x=0;
y=1;
z=1;
}
if(seg==4)
{
seg=0;
                                             27
goto k;
}
for(i=0;i<10;i++)
{
P0=disp[i];
for(j=0;j<1000;j++)
{delay();}
}
seg++;
}
}
void delay(void)
{
TMOD=0x01;
TL0=0xFB;
TH0=0xF3;
TR0=1;
while(TF0==0);
TF0=0;
TR0=0;
}
                      28
9.3 HEX CODE:
:0308AE000108003E
:10088C0075890275A882758CE1D28CAF087E00EF59
:10089C0064467002C291EF64644E70EFD291F50819
:0208AC0080E9E1
:03000B000208B236
:0308B20005083204
:03000000020800F3
:0C080000787FE4F6D8FD758108020847F7
:10080C0002088CE493A3F8E493A34003F68001F26E
:10081C0008DFF48029E493A3F85407240CC8C333ED
:10082C00C4540F4420C8834004F456800146F6DFBC
:10083C00E4800B01020408102040809008AEE47E96
:10084C00019360BCA3FF543F30E509541FFEE493B1
:10085C00A360010ECF54C025E060A840B8E493A378
:10086C00FAE493A3F8E493A3C8C582C8CAC583CAA3
:10087C00F0A3C8C582C8CAC583CADFE9DEE780BE5B
:0108B1000046
:00000001FF
9.4 HARDWARE INTERFACED OUTPUT:
9.5 CONCLUSION:-
We used four 7 segment LED displays to continuously display series of
numbers from 0 to 9. We kept shifting this series from first segment to
last segment.
                                              29
        -:Design of digital voltmeter: Application of ADC:-
10.1 AIM :
Write a program to design of ADC.
10.2 PROGRAM:
// Header: Digital voltmeter.
// Author: SHEELAJ BABU
// Date: 06-May-2020
#include <reg51.h>
#include <intrins.h>
#define display_port P0
sbit ALE=P3^1;
sbit EOC=P3^2;
sbit OE=P3^3;
sbit SOC=P3^4;
sbit CS_A=P3^5;
sbit CS_B=P3^6;
sbit CS_C=P3^7;
unsignedinta,b,c,d,e,f,g,h,i,j,k,V[5];
void ADC_INI(void);
void ADC_READ(void);//function to read data
void calculate(unsignedint u);
sbit RS=P2^7;
sbit RW=P2^6;
sbit EN=P2^5;
void DISP_LCD(void);//function to display data on lcd
voidlcd_ini(void);
voidlcd_cmd(unsignedchar command);
voidlcd_data(unsignedchardispdata);
void delay (unsignedint t);
void main()
                                                        30
    ADC_INI();
while(1)
        ADC_INI();
        ADC_READ();
void ADC_INI()
    P1=0xFF;
    ALE=0;
    SOC=0;
    OE=0;
    EOC=1;
delay(1);
//return;
void ADC_READ()//function to read data
    CS_A=0;
    CS_B=0;
    CS_C=0;
    ALE=1;
delay(1);//to produce delay
    SOC=1;
delay(1);//to produce delay
    ALE=0;
delay(1);//to produce delay
    SOC=0;
delay(1);
while(EOC==1);
delay(1);//to produce delay
    OE=1;
delay(1);//to produce delay
    a=P1;
delay(1);//to produce delay
    OE=0;
calculate(a);
//return;
                                         31
}
void calculate(unsignedint u)
    h=2500/255;
    b=u*h;
V[0]=b/1000+0x30;
    c=b%1000;
V[2]=c/100+0x30;
    d=e%100;
V[3]=e/10+0x30;
    f=e%10;
V[4]=f+0x30;
    DISP_LCD();
//return;
void DISP_LCD()//function to display data on lcd
unsignedchar z[7]="VOLTAGE";// first line to be printed on lcd
lcd_ini();
lcd_cmd(0x80);
for(i=0;i<7;i++)
lcd_data(z[i]);
delay(500);
lcd_cmd(0xC0);
for(i=0;i<5;i++)
if(i==1)
lcd_data('.');
else
lcd_data(V[i]);
delay(500);
//return;
                                                      32
}
voidlcd_cmd(unsignedchar command)
     P0=command;
     RS=0;
     RW=0;
     EN=1;
delay(10);//to produce delay
     EN=0;
voidlcd_data(unsignedchardispdata)
     P0=dispdata;
     RS=1;
     RW=0;
     EN=1;
delay(10);//to produce delay
     EN=0;
voidlcd_ini(void)
lcd_cmd(0x38);
lcd_cmd(0x0F);
lcd_cmd(0x01);
void delay(unsignedint t)//to produce delay
for(j=0;j<t;j++)
for(k=0;k<1000;k++)
{}
                                              33
10.3 HEX CODE:
:03000000020B11DF
:0C0B1100787FE4F6D8FD75812E020B1DE4
:070B2800564F4C54414745B4
:0B0B1D00120ACC120ACC120A6280F807
:100ACC007590FFC2B1C2B4C2B3D2B27F017E000234
:020ADC000A9E70
:100A6200C2B5C2B6C2B7D2B1120A9AD2B4120A9AA7
:100A7200C2B1120A9AC2B4120A9A20B2FD120A9A9A
:100A8200D2B3120A9AAF907512008F13120A9AC249
:080A9200B3AF13AE1202095DBF
:10095D00752000752109AC20AD211208F68E148F7B
:10096D00157C037DE8120908EF2430F509E43EF506
:10097D0008AE14AF157C037DE81209088C168D178F
:10098D00AE16AF177C007D64120908EF2430F50D0B
:10099D00E43EF50CAE1AAF1B7C007D641209088C89
:1009AD00188D19AE1AAF1B7C007D0A120908EF24B1
:1009BD0030F50FE43EF50EAE1AAF1B7C007D0A122A
:1009CD0009088C1C8D1DE51D2430F511E4351CF531
:0409DD00100209E11A
:1009E10078287C007D007BFF7A0B79287E007F07C9
:1009F1001208D0120B027F80120ADEE4F522F523E1
:100A010074282523F8E6FF120AF07FF47E01120A0A
:100A11009E0523E52370020522C39407E522940075
:100A210040DE7FC0120ADEE4F522F523E5236401EE
:100A3100452270077F2E120AF08014E52325E02459
:100A410008F808E6FF120AF07FF47E01120A9E05FB
:100A510023E52370020522C39405E522940040CCCE
:010A61002272
:100ADE008F80C2A7C2A6D2A57F0A7E00120A9EC22E
:020AEE00A5223F
:100AF0008F80D2A7C2A6D2A57F0A7E00120A9EC20C
:020B0000A5222C
:0F0B02007F38120ADE7F0F120ADE7F01020ADE41
:040A9A007F017E005A
:100A9E00E4F524F525C3E5259FE5249E501FE4F5D6
:100AAE0026F5270527E52770020526B4E8F5E52685
:0E0ABE00B403F00525E52570DC052480D82260
:10080000E709F608DFFA8046E709F208DFFA803EDA
:1008100088828C83E709F0A3DFFA8032E309F608C7
:10082000DFFA8078E309F208DFFA807088828C832F
:10083000E309F0A3DFFA806489828A83E0A3F608E3
:10084000DFFA805889828A83E0A3F208DFFA804CBD
:1008500080D280FA80C680D4806980F28033801094
:1008600080A680EA809A80A880DA80E280CA8033FD
:1008700089828A83ECFAE493A3C8C582C8CCC58375
:10088000CCF0A3C8C582C8CCC583CCDFE9DEE78045
:100890000D89828A83E493A3F608DFF9ECFAA9F0C4
:1008A000EDFB2289828A83ECFAE0A3C8C582C8CC1A
:1008B000C583CCF0A3C8C582C8CCC583CCDFEADE33
:1008C000E880DB89828A83E493A3F208DFF980CC95
:1008D00088F0EF60010E4E60C388F0ED2402B4048E
:1008E0000050B9F582EB2402B4040050AF23234535
:0608F00082239008507302
:1008F600EF8DF0A4A8F0CF8CF0A428CE8DF0A42E16
:02090600FE22CF
:10090800BC000BBE0029EF8DF084FFADF022E4CCD3
:10091800F875F008EF2FFFEE33FEEC33FCEE9DEC9C
:10092800984005FCEE9DFE0FD5F0E9E4CEFD22EDE2
:10093800F8F5F0EE8420D21CFEADF075F008EF2F2C
:10094800FFED33FD4007985006D5F0F222C398FD1D
:050958000FD5F0EA22BA
:00000001FF
                                              34
10.4 HARDWARE INTERFACED OUTPUT:
10.5 CONCLUSION:
Finally We have successfully implemented Digital voltmeter.
                                            35
                    -:Interfacing of servo motor:-
11.1 AIM :
Implement Interfacing of servo motor with 8051 microcontroller.
11.2 ASSEMBLY PROGRAM:
// Author: SHEELAJ BABU                                 
// Date: 29-May-2020                                                                
ORG00H//Start the program
MAIN:
MOV TMOD, #01H;using Timer 0 in Mode 1
LCALL zero_degrees;Function to move to position = 0 deg
LCALL delay ;Function to create a delay of 1 sec
LCALL ninety_degrees;Function to move to position = 90 deg
LCALL delay ;Function to create a delay of 1 sec
LCALL one_eighty_degrees;Function to move to position = 180 deg
LCALL delay ;Function to create a delay of 1 sec
SJMP MAIN ;to repeat the loop until manually stopped
RET
zero_degrees://To create a pulse of 1ms
MOV TH0, #0FCH;to be calculated
MOV TL0, #19H;to be calculated
SETBP2.0 ;Make P2.0 HIGH
SETBTR0 ;Start the timer 0
WAIT1:JNB TF0, WAIT1 ;Wait till the TF0 flag is set
                                            36
CLR P2.0 ;Make P2.0 LOW
CLR TF0 ;Clear the flag manually
CLR TR0 ;Stop the timer 0
RET
ninety_degrees://To create a pulse of 1.5ms
MOV TH0, #0FAH;to be calculated
MOV TL0, #25H;to be calculated
SETBP2.0 ;Make P2.0 HIGH
SETBTR0 ;Start the timer 0
WAIT2:JNB TF0, WAIT2 ;Wait till the TF0 flag is set
CLR P2.0 ;Make P2.0 LOW
CLR TF0 ;Clear the flag manually
CLR TR0 ;Stop the timer 0
RET
one_eighty_degrees://To create a pulse of 2ms
MOV TH0, #0F8H;to be calculated
MOV TL0, #31H;to be calculated
SETBP2.0 ;Make P2.0 HIGH
SETBTR0 ;Start the timer 0
WAIT3:JNB TF0, WAIT3 ;Wait till the TF0 flag is set
CLR P2.0 ;Make P2.0 LOW
CLR TF0 ;Clear the flag manually
CLR TR0 ;Stop the timer 0
RET
delay://To create a delay of 1sec
MOV R4,#64H;to be calculated
LOOP1:MOV R3,#64H;to be calculated
LOOP2:MOV R2,#64H;to be calculated
LOOP3:DJNZ R2,LOOP3
DJNZ R3,LOOP2
DJNZ R4,LOOP1
                                              37
RET
END
11.3 HEX CODE:
:1000000075890112001812005412002C12005412AB
:10001000004012005480E922758CFC758A19D2A028
:10002000D28C308DFDC2A0C28DC28C22758CFA7527
:100030008A25D2A0D28C308DFDC2A0C28DC28C2266
:10004000758CF8758A31D2A0D28C308DFDC2A0C2D9
:100050008DC28C227C647B647A64DAFEDBFADCF687
:01006000227D
:00000001FF
11.4 SIMULATED OUTPUT:
Wavform at P2.0 which confirms tha P2 output:
11.5 CONCLUSION:
Servo motor is interfaced with 8051 microcontroller successfully and works according to
instructions given by the 8051 microcontroller.
                                             38
39
CERTIFICATE
     40