Friday, 14 December 2012

LCD INTERFACING WITH 8051 IN 8-BIT MODE

Here we use a 16x2 LCD which is interfaced by P89V51RD2 which is a 8051 micricontroller.

A 16x2 LCD is shown below.



Pin configuration is written behind this LCD as...

1       -   GND
2       -   VCC (+5V)
3       -   VEE  (FOR CONTRAST)
4       -    RS    (REGISTER SELECT)
5       -    RW   (READ/WRITE)
6       -    EN    (ENABLE)
7-14  -    DATA PINS D0-D7
15      -   LED PLUS
16      -   LED MINUS

Components required :-


  1. 10uf electrolytic capacitor
  2. 10k ohm registance
  3. 10k ohm variable registance
  4. 11.059 MHZ crystal oscilltor
  5. 16x2 LCD
  6. P89V51RD2 IC
  7. 5v battery 


Circuit diagram : - 




Burn this code in microcontroller and Make the connections..

Code :-
----------------------------------------------------------------------------------------------------------------------------------


#include <REG51.H>
int i,j,k;
sbit RS=P3^0;
sbit RW=P3^1;
sbit EN=P3^6;
void delay();
void lcd_cmd(unsigned char value);
void lcd_data(unsigned char value);
char a[6]="ashish";
char b[8]="chittora";


void main()
{
   while(1)
   {   
 lcd_cmd(0x38);
 delay();
 lcd_cmd(0x0e);
 delay();
 lcd_cmd(0x06);
 delay();
 lcd_cmd(0x01);
 delay();
 
 
 for(j=0;j<6;j++)
 {
   lcd_data(a[j]);
delay();
 }
 lcd_cmd(0xc0);
 
 
 for(k=0;k<8;k++)
 {
   lcd_data(b[k]);
delay();
 }
   
  }
}
void delay()
  {
    for(i=0;i<2;i++)
    {
      TMOD=0X01;
      TH0=0X4B;
      TL0=0XFD;
      TR0=1;
      while(TF0==0);
      TF0=0;
      TR0=0;
    }
  }
void lcd_cmd(unsigned char value)
   {
     RS=0;
RW=0;
P2=value;
EN=1;
delay();
EN=0;
   }
void lcd_data(unsigned char value)
   {
     RS=1;
RW=0;
P2=value;
EN=1;
delay();
EN=0;
   }    

----------------------------------------------------------------------------------------------------------------------------------


after this switch on the circuit.




Note :- If you have problem to see characters in LCD then reduce the contrast level of LCD by increasing the resistance of 10k variable resistor.


Contact us for the code in c language.

IF YOU HAVE ANY QUERY THAN CONTACT US OR GIVE YOUR QUERY IN THE QUERY OPTION.      
                                                            GOOD LUCK

More embedded projects >>....                             More MAT LAB projects>>...


Saturday, 17 November 2012

PROGRAM FOR FIBONACCI SERIES IN JAVA

Here is the program for display fibonacci series in JAVA.

------------------------------------------------------------------------------------------------------------


class A

{

        int a,b,c;

        A ()

        {

                a = 1;

                b = 0;

        }

        void create ( int n )

        {

                for ( int i=0 ; i<n ; i++ )

                {

                        c = a + b;

                        System.out.print(b + "   ");

                        a = b;

                        b = c;

                }

        }

}

class Fibonacci

{

        public static void main ( String args[] )

        {

                int m = Integer.parseInt ( args[0] );

                A a = new A();

                System.out.println("\n\nFibonacci Series - \n\n");

                a.create( m );

                System.out.println("\n");

        }

}

------------------------------------------------------------------------------------------------------------






IF YOU HAVE ANY QUERY THAN CONTACT US OR GIVE YOUR QUERY IN THE QUERY OPTION.      
                                                            GOOD LUCK

More embedded projects >>....                             More MAT LAB projects>>...


Wednesday, 7 November 2012

PROTEUS TUTORIAL

Now you can make and check your circuits without making them in real. This software PROTEUS is awesome for this purpose. You can also check your programs written for microcontrollers by loading them in M.C.

Here we use ISIS PROTEUS version 7.

follow the steps....

1.  Open ISIS.


2.  Select your required components from the library. Click on the 'P' button given at top left side.

3.  Now a window opens like below. Search your component by writing the appropriate name, select the component and press OK.



4.   Double click on the screen and place your component.



5.  Make the connections by click on terminals. You can found power and ground terminals here.              Right click>place>terminals>.....


6.  Double click on M.C. and brows and load your program hex file. Click OK.



7.  After all the above steps click the play button given at the bottom left side in the window. Click play and your circuit will be run.







IF YOU HAVE ANY QUERY THAN CONTACT US OR GIVE YOUR QUERY IN THE QUERY OPTION.      
                                                            GOOD LUCK

More embedded projects >>....                             More MAT LAB projects>>...



Monday, 5 November 2012

FLASH MAGIC TUTORIAL

Here we learn that, how to burn the program in a microcontroller.

We use Flash magic software for this purpose.

Note :-
             Flash magic only works on those microcontrollers which have serial ports or support serial programming. It can not burn the microcontrollers like at89c51 or others which does not support serial programming.

STEPS :-
         
1. Open the flash magic.


2.  select your microcontroller.
                                      

3.  select your baud rate. (usually it 7200 or 9600).

                                        

4.  select your com port.

                                       

5. To see your com port follow below steps. Right click on the my computer and click on manage.
                                

6.  Then click on device drivers. Now click on Usb com ports and see your com port. If you use usb to serial cable (RS232) then it is shown as usb portliftic cable.

                                    

7.  Now check the box ERASE ALL FLASH.
                                       

8.  Check the box VERIFY AFTER PROGRAMMING.
                                     

9.  Click on brows to brows your program Hex file.

                                  



10.  Now Click START to start the burning process.

Errors :- 

1. If there is error of changing the baud rate then change your baud rate and try again.

2. If there is error of connection and then check your com port again.




IF YOU HAVE ANY QUERY THAN CONTACT US OR GIVE YOUR QUERY IN THE QUERY OPTION.      
                                                            GOOD LUCK

More embedded projects >>....                             More MAT LAB projects>>...



Thursday, 1 November 2012

SIMPLE CALCULATOR IN GUI MAT LAB

Here we learn to make a simple calculator in GUI function of MAT LAB. Follow all the steps :-



Note :- 
              You should have the MAT LAB version 7.0 or above. Here I use MAT LAB version 11.

Read the full post and follow the step.

1.  Open the MAT LAB. Go to File>>New>>GUI.



2.  Now a window opens like below. Select blank GUI(default) and click OK.


3.  Now a blank GUI figure opens.


4.  Here we use 17 push buttons and 1 static text editor. So place these components from the list at the left side. Push button is given as OK in the list and static text is given as TXT in the list. Arrange them in a proper order of your choice. Change their string names by double clicking on them individually one by one. You can also choose the color of static text box.


5.  Save this file. After saving a window opens which is a script file and it contains functions of all the buttons that are used in GUI figure. That window looks like below.....



6.  Scroll down above script file and look for functions of push buttons as given below...


This function is given for every button as you scroll down the page.

7.  Now we write definition of function of each button... as described below...... paste this code below the function declaration as shown in image below.....


8.  Here is code given for each button...
  • for button 1(it prints 1)

------------------------------------------------------------------------------------------------------------

global jj
textString = get(handles.text1,'String');

if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','1') ;
else
textString =strcat(textString,'1');
set(handles.text1,'String',textString)

end
jj=0;
------------------------------------------------------------------------------------------------------------
  • for button 2(it prints 2)

------------------------------------------------------------------------------------------------------------

global jj
textString = get(handles.text1,'String');

if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','2') ;
else
textString =strcat(textString,'2');
set(handles.text1,'String',textString)

end
jj=0;
------------------------------------------------------------------------------------------------------------

  • for button 3(it prints 3)

------------------------------------------------------------------------------------------------------------

global jj
textString = get(handles.text1,'String');

if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','3') ;
else
textString =strcat(textString,'3');
set(handles.text1,'String',textString)

end
jj=0;
------------------------------------------------------------------------------------------------------------
  • for button 4(it prints 4 )

------------------------------------------------------------------------------------------------------------

global jj
textString = get(handles.text1,'String');

if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','4') ;
else
textString =strcat(textString,'4');
set(handles.text1,'String',textString)

end
jj=0;
------------------------------------------------------------------------------------------------------------
  • for button 5(it prints 5)

------------------------------------------------------------------------------------------------------------

global jj
textString = get(handles.text1,'String');

if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','5') ;
else
textString =strcat(textString,'5');
set(handles.text1,'String',textString)

end
jj=0;
------------------------------------------------------------------------------------------------------------
  • for button 6(it prints 6)

------------------------------------------------------------------------------------------------------------

global jj
textString = get(handles.text1,'String');

if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','6') ;
else
textString =strcat(textString,'6');
set(handles.text1,'String',textString)

end
jj=0;
------------------------------------------------------------------------------------------------------------
  • for button 7(it prints 7)

------------------------------------------------------------------------------------------------------------

global jj
textString = get(handles.text1,'String');

if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','7') ;
else
textString =strcat(textString,'7');
set(handles.text1,'String',textString)

end
jj=0;
------------------------------------------------------------------------------------------------------------
  • for button 8(it prints 8)

------------------------------------------------------------------------------------------------------------

global jj
textString = get(handles.text1,'String');

if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','8') ;
else
textString =strcat(textString,'8');
set(handles.text1,'String',textString)

end
jj=0;
------------------------------------------------------------------------------------------------------------
  • for button 9(it prints 9)

------------------------------------------------------------------------------------------------------------

global jj
textString = get(handles.text1,'String');

if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','9') ;
else
textString =strcat(textString,'9');
set(handles.text1,'String',textString)

end
jj=0;
------------------------------------------------------------------------------------------------------------
  • for button 10(it prints 0)

------------------------------------------------------------------------------------------------------------

global jj
textString = get(handles.text1,'String');

if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','0') ;
else
textString =strcat(textString,'0');
set(handles.text1,'String',textString)

end
jj=0;
------------------------------------------------------------------------------------------------------------
  • for button 11(it prints 00)

------------------------------------------------------------------------------------------------------------

global jj
textString = get(handles.text1,'String');

if(strcmp(textString,'0.')==1)&(jj==0)
   set(handles.text1,'String','00') ;
else
textString =strcat(textString,'00');
set(handles.text1,'String',textString)

end
jj=0;
------------------------------------------------------------------------------------------------------------
  • for button 12(it prints +)

------------------------------------------------------------------------------------------------------------

textString = get(handles.text1,'String');
textString =strcat(textString,'+');
set(handles.text1,'String',textString)

------------------------------------------------------------------------------------------------------------

  • for button 13(it prints -)

------------------------------------------------------------------------------------------------------------

textString = get(handles.text1,'String');
textString =strcat(textString,'-');
set(handles.text1,'String',textString)

------------------------------------------------------------------------------------------------------------

  • for button 14(it prints *)

------------------------------------------------------------------------------------------------------------

textString = get(handles.text1,'String');
textString =strcat(textString,'*');
set(handles.text1,'String',textString)

------------------------------------------------------------------------------------------------------------

  • for button 15(it prints /)

------------------------------------------------------------------------------------------------------------

textString = get(handles.text1,'String');
textString =strcat(textString,'/');
set(handles.text1,'String',textString)

------------------------------------------------------------------------------------------------------------
  • for button 16 for equal to or for evaluate the answer(for executing the input numbers)
------------------------------------------------------------------------------------------------------------
textString = get(handles.text1,'String');
ans =eval(textString);
set(handles.text1,'String',ans)
------------------------------------------------------------------------------------------------------------
  • for button 17(it clears the display)
------------------------------------------------------------------------------------------------------------
set(handles.text1,'String','0.') ;
------------------------------------------------------------------------------------------------------------

9.  After these steps press run from the GUI figure window. If it asked for the change path then click on the change folder. A new window opens and your calculator is ready to run.



IF YOU HAVE ANY QUERY THAN CONTACT US OR GIVE YOUR QUERY IN THE QUERY OPTION.      
                                                            GOOD LUCK

More embedded projects >>....                             More MAT LAB projects>>...




Sunday, 28 October 2012

Program for Normal Distribution using CDF

Here is a program of MAT LAB for normal distribution N(mu,sigma) using CDF.
CDF stands for Cumulative Density Function.

open MAT LAB open new script and paste this program :-

Program :-
-----------------------------------------------------------------------------------------------------------------------


mu=100;
sigma=15;
xmin=70;
xmax=130;
n=100;
k=10000;
x=linspace(xmin,xmax,n);
c=normcdf(x,mu,sigma);
plot(x,c);
xlabel('x');
ylabel('cdf');
title('cumulative density function');

-----------------------------------------------------------------------------------------------------------------------

just paste the program, press run.

Output :-





IF YOU HAVE ANY QUERY THAN CONTACT US OR GIVE YOUR QUERY IN THE QUERY OPTION.      
                                                            GOOD LUCK

More embedded projects >>....                             More MAT LAB projects>>...


Program for Normal Distribution using PDF

Here is a program of MAT LAB for normal distribution N(mu,sigma) using PDF.
PDF stands for Probability Density Function.

open MAT LAB open new script and paste this program :-

Program :-
-----------------------------------------------------------------------------------------------------------------------


mu=100;
sigma=15;
xmin=70;
xmax=130;
n=100;
k=10000;
x=linspace(xmin,xmax,n);
p=normpdf(x,mu,sigma);
plot(x,p);
xlabel('y');
ylabel('pdf');
title('probability density function');

-----------------------------------------------------------------------------------------------------------------------


just paste the program, press run. :-

Output :-

IF YOU HAVE ANY QUERY THAN CONTACT US OR GIVE YOUR QUERY IN THE QUERY OPTION.      
                                                            GOOD LUCK

More embedded projects >>....                             More MAT LAB projects>>...



Histogram of Random Number Distribution

Here is a program for random number distribution from N(mu,sigma).  (HISTOGRAM)

open MAT LAB open new script and paste this program :-

Program :-

-----------------------------------------------------------------------------------------------------------------------



mu=100;
sigma=15;
k=10000;
y=normrnd(mu,sigma,k,1);
%subplot(133);
hist(y,20);
xlabel('y');
ylabel('frequency');
title('histogram of random values');

-----------------------------------------------------------------------------------------------------------------------

just paste the program, press run.

Output :-




IF YOU HAVE ANY QUERY THAN CONTACT US OR GIVE YOUR QUERY IN THE QUERY OPTION.      
                                                            GOOD LUCK

More embedded projects >>....                             More MAT LAB projects>>...


Generation of Random signal

Here is a program of MAT LAB for generation of random signals in continuous and discreet form.

open MAT LAB open new script and paste this program :-

Program :-
-----------------------------------------------------------------------------------------------------------------------


n=input('enter yhe value of n=');
x=rand(1,n);
subplot(211);
stem(x);
ylabel('amp.');
xlabel('time');
title('dis. random signal');


subplot(212);
plot(x);
ylabel('amp.');
xlabel('time');
title('cont. random signal');

-----------------------------------------------------------------------------------------------------------------------

just paste the program, press run, enter the value of 'n' (numerical). get output :-

Output :-

Note :-
              output will be different every time because it is a random signal

IF YOU HAVE ANY QUERY THAN CONTACT US OR GIVE YOUR QUERY IN THE QUERY OPTION.      
                                                            GOOD LUCK

More embedded projects >>....                             More MAT LAB projects>>...



Program for Addition & Subtraction of two signals

Here is a program of MAT LAB for addition & subtraction of two signals in continuous and discreet form.

open MAT LAB open new script and paste this program :-

Program :-
-----------------------------------------------------------------------------------------------------------------------


n=input('enter the value of n=');
t=0:0.005:n;
f=1;


x=sin(2*pi*f*t);
y=cos(2*pi*f*t);
z=x+y;
z1=x-y;


subplot(321);
plot(t,x);
ylabel('amp.');
xlabel('time');
title('cont. sine wave');


subplot(322);
plot(t,y);

ylabel('amp.');
xlabel('time');
title('cont. cosine wave');


subplot(323);
plot(t,z);
ylabel('amp.');
xlabel('time');
title('cont. addition wave');


subplot(324);
plot(t,z1);
ylabel('amp.');
xlabel('time');
title('cont. subtraction wave');


subplot(325);
stem(t,z);
ylabel('amp.');
xlabel('time');
title('dis. addition wave');


subplot(326);
stem(t,z1);
ylabel('amp.');
xlabel('time');
title('dis. subtraction wave');

-----------------------------------------------------------------------------------------------------------------------

just paste the program, press run, enter the value of 'n' (numerical). get output :-

Output :-

IF YOU HAVE ANY QUERY THAN CONTACT US OR GIVE YOUR QUERY IN THE QUERY OPTION.      
                                                            GOOD LUCK

More embedded projects >>....                             More MAT LAB projects>>...


Program for Convolution of two signals

Here is a program for convolution of two signals in MAT LAB in continuous and discreet form.

open MAT LAB open new script and paste this program :-

Program :-

-----------------------------------------------------------------------------------------------------------------------


n=input('enter the value of n=');
t=0:0.02:n;
f=1;

x1=sin(2*pi*f*t);
subplot(321);
plot(t,x1);
ylabel('amp.');
xlabel('time');
title('cont. sine wave');


subplot(323);
stem(t,x1);
xlabel('time');
ylabel('amp.');
title('dis. sine wave');

y1=cos(2*pi*f*t);
subplot(322);
plot(t,y1);
xlabel('time');
ylabel('amp.');
title('cont. cosine wave');

subplot(324);
stem(t,y1);
xlabel('time');
ylabel('amp.');
title('dis. cosine wave');

z1=conv(x1,y1);
subplot(325);
plot(z1);
xlabel('time');
ylabel('amp.');
title('cont. time convolution');

subplot(326);
stem(z2);
xlabel('time');
ylabel('amp.');
title('dis. time convolution');

-----------------------------------------------------------------------------------------------------------------------

just paste the program, press run, enter the value of 'n' (numerical). get output :-

Output :-

IF YOU HAVE ANY QUERY THAN CONTACT US OR GIVE YOUR QUERY IN THE QUERY OPTION.      
                                                            GOOD LUCK

More embedded projects >>....                             More MAT LAB projects>>...