Thursday 6 November 2014

Getting Start With XILINX ISE WebPack Version 14.7(AND gate program)

Steps to write VHDL code in XILINX ISE WebPack
      Here are the steps to write a VHDL code in behavioural modelling style using Xilinx web pack version.
First visit Xilinx official website and download fresh copy of XILINX ISE design suite Web Pack version. It’s a freeware for student choose code limit version.
After download Xilinx ISE install it in C drive and open it.
Here is your first Program.
Step 1:-

Click on new project

Step 2:- Now after click on new project it open a new window


Step 3:-Click on next button next window is project settings now don’t do anything click on next button and then finish button.
After click on finish button this window will open


Step 4:- after click on new source file this window will open


Step 5 :- when you click on next button a new window will open where you have to enter input output variable for example
If you are designing and gate then you have 2 inputs and 1 output


Step6:- Click on next button next window will open with your file where you can write your vhdl program here I attached next snapshot of that. 


Step 7:- here is your AND gate program when there is no syntax error click on implement design and then check simulation of your program.




Friday 31 October 2014

Generate a Delay using for loop in Embedded C using Microcontroller 8051

/* In Microcontroller programming if you want to generate a normal delay then you can generate using for loop also.
Here i m gonna write a program to toggle a bit of port P0 of microcontroller using delay.
*/

#include<Reg51.h>

sbit MyBit = PO^1 ;
void My_Delay(unsigned char z) ;

void main()
{
   while(1)
       {
          MyBit = 1 ;
            My_Delay(1500) ;
          MyBit = 0 ;
            My_Delay(1500) ;
       }


}

void My_Delay(unsigned char z)
   {
       int i ;
   for(i=0 ; i <= z ; i++) ; //to generate more delay you can use two for loops
   }

Proteous Simulation of above code is here



Wednesday 29 October 2014

8051 Microcontroller interfacing with seven segment using Embedded C and simulation over proteous.

   
//this program run and compile with kiel uvision 3
// Here is your program :-
#include<reg51.h>
#define SegmentPort P1   //this line assigne variable segmentport to port P1

void MsDelay(int x) ;   //delay function prototype
void main()
{     
    unsigned char z,x ;
  char MyArray[]={0xc0,0xf9,0xA4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff} ;
    //this array content hex value equal to 0 to 9 decimal values this value can be change according to seven segment.
  SegmentPort = 0x00 ;  //here P1 define as a output port
   while(1)
    {
          for(z=0;z<=11;z++)
           {
                   P2 = MyArray[z] ;
                   MsDelay(4000); //this will generate 4 second delay
                   }

void MsDelay(int x) //this function takes value to generate dealy
{
        int i;
        for(i=0;i<x;i++)
        {
           TH0=0xFC;  //this values generate 1 ms delay but we write this code
           TL0=0x18; //in for loop this mean if we entere 4000 it will gives 4 sec   
            TR0=1;  // of delay
                while(TF0==0);
                TR0=0;
                TF0=0;
        }
 }



Proteous interfacing of seven segment with 8051 controller



Thursday 9 October 2014

Basic Rules of VHDL coding for Beginner

:-Basic Rules of VHDL which should be in mind before start with This language

1-Its Hardware description language that means it’s not an only programming language it’s a language with the help of we can design a new hardware. Every single line of your code can affect hardware. we can design a new controller also and other digital logic using VHDL language.

2-you have a little knowledge how your hardware should look like because VHDL is a very powerful language you should have knowledge about basic digital circuits. Design a digital circuit is similar to other high level programming language but VHDL is complicated language it’s not like other programming language.

:-TOOL needed for VHDL

     Every engineer without its tool is like angel without her magical wand so here also to work with VHDL language you need some tool.Here I mention few basic tool which you need during your digital design.

:-SOFTWARE

XILINX ISE –This is IDE(integrated development Enviroment) where you write                    your VHDL codes its comes with inbuilt simulation tool names ISIM which is use to see output.

Modelsim student PE- This is a product of mentor graphics you can download a license student version its use for simulation purpose.

:-Hardware

FPGA Board –field programmable gate array this is hardware in which we will test our design.


CPLD  Board- Complex programmable logic device this is also we can use for same purpose.

C program which return power of integer Value using a function (base to the power)

   C program which return power of integer Value using a function (base power)

Question-> Write a integer power function which return the power of base

      This program return the value of any integer power the integer value will entered by user for example 52 = 25,5= 125. Here I used a function which both value base and exponent.function name is integer_power you can redefine this function it takes two integer type variable.This program is only for integer values.

#include<stdio.h>

int integer_power(int x,int y) ; //prototype of function

int main()
{
  int base,exponent ;
  int final_answer ;  //variable      
  printf("-------Enter the value of base and exponent---------\n") ;
  printf("Enter value of base-") ;
  scanf ( "%d" , &base) ; //fetch base value from user
  printf( "Enter value of exponent-" ) ;
  scanf( "%d" , &exponent) ; //fetch exponent value from user
  final_answer = integer_power(base,exponent) ;
  printf( "\nyour final answer is %d" ,final_answer) ;
}

int integer_power(int x , int y) //here my function which return final value
{
        int z;
        int total=1;
        for(z=1 ; z<=y ; z++)
         {
                total = x*total ; //return final value
         }
        return total ;


C program to Send 0-255 Character to port P0 in 8051 Controller

#include<reg51.h> //header file used in 8051 controller                
                             // programming
void main()
{
  Unsigned char x  ;
 For (x=0 ; x <= 255 ; x++)
          {
      P1 = x ;
          }


} //End of main

Wednesday 8 January 2014

How to Debug a program in C language(Run every line of code )

     

Debugging is most important method while you are dealing with C language. Use of breakpoint,single line execution button is also has its own importance. If you want to be a good developer of C programming you should know how to use debug button in a program.

Here Definition of Debugging. I copied this from one of websites.

"Debugging tools (called debuggers) help identify coding errors at various development stages. Some programming language packages include a facility for checking the code for errors as it is being written."


But main thing is that how to use debug method in a program and how to use watch button in Integrated development environment(Dev C++). Here i am going to introduce debug method with Dev c++ firmware snaps.


1-When you compiled your program and remove all errors then do not click on  run but instead go with debug option. You can see in image debug option available below your program.








2-When you click on debug option two option will enable debug and add watch.








3-Here you perceive one more option ADD WATCH. Using this button you can watch variable values and how those values change during debugging. It helps you to optimize how values changes in a variable. when you click on watch button another window will open,like this.

here is example of how to use watch function.












4- How to use breakpoints.
  breakpoints is another significant part of debugging. Breakpoints used to stop execution process at particular line of your program. This is the best way to find and get rid of errors.
  To use breakpoints you just have to click on numbers which is in left of your program when you click at this point a red round mark will appear. 
    


5- Now click the run button then you will see some more option below your program.initially program will stop at your first breakpoint after that you have option either execute it step by step or run all program.

Tuesday 7 January 2014

5 steps to start C programming with Dev C++ in

1.- download Dev C++ software from here click to download Dev C++   when you download and install Dev C ++ IDE on your computer or Laptop then double click the Dev C icon appear on Computer Desktop. You will see a window will open.

2.-People always start with new file but that is not a correct way to start particularly for beginner. Begin with to  choose a  new project. Here i the snap shot example.
    Go with this hierarchy
 File menu 
                  > New 
                              > Project 






3- When you choose project option then a new window will open then select console application option and after select console application below Enter project name. Its depend upon programmer which name He/She want and select C programing option project between C and C++.














4- When you complete this process click OK button and Save your project in proper location. When you finish this in your dev C++ window there is project option window click on that project option it consist two option test(its your project name) and main.c file. Programmer can write his/her code in this file.













5- Here your workspace now you write  your code or program here and compile  and run it.After that you can see output of your program.

Monday 6 January 2014

First program in C

/* First C program  this line is a comment dont take part in programme */

#include<stdio.h>

int main(void)
  {
     printf("Welcome to C world !") ;
     return 0 ;
  } //end of main

Here your output in black screen
---------------------------------------------------------------------------------
Welcome to C world !
---------------------------------------------------------------------------------

Common Programming Error:-

How to start C programming as beginner and Do's and dont's for C beginner

       When someone imagine to learn C programming he or she thinks its very simple we have to go market and purchase  best book for C programming and start reading. After buying book thought comes in mind " hurry hurry ! finally we did " and we initiate very good step but after few days their book found a corner place because they feel boredom and lost their interest on that book .
       Before start learning C language you have to learn where we write these C programmed and how to Run,debug and execute it. We have to first learn about IDE(integrated development environment).
       Here i am listing few IDE where you can write C program and can see the output

1.- Dev C++ (best for beginner)
2.- Codeblocks
3.- Ecilipse (Best but for professional)

      If you want to download one of these IDE so you have to little googling or you can go with below links

Click here to download Dev C++

Click here to download Ecilipse IDE

Click here to download Codeblock IDE

In my next post we will discuss how to fun with C

Compiler for C,C++ and Python {paste your programme to see the output}