• 1

    ..

  • 2

    ...

  • 3

    ...

Thursday 27 December 2012

Tuesday 25 December 2012

COMMAND LINE ARGUMENTS IN C

COMMAND LINE ARGUMENTS

  • Here the argument are passed to main functions through the command prompt and its very useful feature in c language 
  • the CLM consists of two main argument passing variables that are  INT  ARGC and CHAR **ARGV[]  , 
  • The argc shows the number of argument that has been passed to the main function through command prompt. and it will be in the integer data type .
  • The character array argv[] has been used to store the arguments . and here the argv[0] will consists of program name and agrv[1],argv[2]...will consists of argument values.  

        the main syntax of command line argument is given below

                          #include <headerfile.h>

                          void  main(int argc ,char ** argv[])
                              {
                             
                             }



   =>   let us see an example for command line argument .
        Addition of two numbers

           1.In TC   c:/tc/bin
            program name : add.c

          
              #include<stdio.h>
              #include<conio.h>
              void main(int argc,char  **argv[])
              {
                      int a,b,c;
                     a=atoi(argv[1]);

                     b=atoi(argv[2]);   //atoi can be used to covert character to integer
                  
                      if(argc!=3)
                       {
                          printf("invalid input");
                          exit(0);
                        }
                     
                      c=a+b;
                    printf("c= %d",c);
              }




     PROGRAM AND OUTPUT WINDOW:

                   
                          

Friday 21 December 2012

MatLab Programs - IMPULSE - STEP - SINE - COSINE -TRIANGULAR - SAWTOOTH - EXPONENTIAL SIGNALS GROWING DECAYING -



 MatLab Programs

 
In this post the matlab code for basic DSP signal generation  are available. These are tested and outputs are also added.
  • Impulse signal
  • Step signal (Delayed Step)
  • Sine signal
  • Cosine signal
  • Triangular signal
  • Sawtooth signal
  • Exponential signals growing & decaying

Monday 3 December 2012

AVR - SPI - Serial Pheripheral Interface Tutorial - ATmega8 Code

AVR - SPI - Serial Pheripheral Interface Tutorial - C Code Example - ATmega8 Code


AVR ATMega8 microcontroller has inbuilt SPI module. First SPI intorduction, and then let us see how to use it.

Serial Peripheral Interface Bus or SPI  bus is a synchronous serial data link standard, named by Motorola, that operates in full duplex mode. Devices communicate in master/slave mode where the master device initiates the data frame. Multiple slave devices are allowed with individual slave select (chip select) lines. Sometimes SPI is called a four-wire serial bus, contrasting with three-, two-, and one-wire serial buses. SPI is often referred to as SSI

Search Here...