Sunday, 25 August 2013

Complete stack program using switch case:


#include<stdio.h>
#include<conio.h>
#define max_size 40
typedef struct stack
{
        int element[max_size];
        int tos;
        }stack;
       
        void init_stack(stack *);
        void push(stack *,int item);
        int pop(stack *);
        void display(stack *);
       
        int main()
        {
            stack s;
            int i;
            int ch;
            init_stack(&s);
            push(&s,1);
            push(&s,2);
            push(&s,3);
            push(&s,4);
            push(&s,5);
           
            while(ch!=4)
            {
                   printf("\n press 1 to push \n");
                   printf("press 2 to pop \n");
                   printf("press 3 to display \n");
                   printf("press 4 to quit \n");
                   printf("enter your choice: \n");
                   scanf("%d",&ch);
                   switch(ch)
                   {
                       case 1:
                       printf("\n enter the element to be pushed \n");
                       scanf("%d",&i);
                       push(&s,i);
                       break;
                      
                       case 2:
                       i=pop(&s);
                       printf("\n you have popped value %d \n",i);
                       break;
                      
                       case 3:
                       display(&s);
                       break;
                      
                       case 4:
                       break;
                      
                       default:
                       printf("\n wrong choice try again \n");
                      }
                  }
                 getch();
                }
                                                         
                void init_stack(stack *s)
                {
                      s->tos=-1;
                }
                                                              
                void push(stack *s,int item)
                {
                     if(s->tos==max_size-1)
                     printf("overflow situation \n");
                     else
                     {
                           s->tos=s->tos+1;
                           s->element[s->tos]=item;
                      }
                 }
                                                                       
                int pop(stack *s)
                 {
                      int data;
                      if(s->tos==-1)
                      {
                          printf("underflow situation \n");
                          return NULL;
                       }
                       else
                       {
                           data=s->element[s->tos];
                           s->tos=s->tos-1;
                           return(data);
                        }
                  }
                                                                                             
                  void display(stack *s)
                  {
                      int i;
                      if(s->tos==-1)
                      printf("stack is empty, nothing to display \n");
                      else
                       {
                           for(i=s->tos;i>=0;i--)
                           printf("%d ",s->element[i]);
                      }
                   }
                                                                                             
                                                               
                                        
           

How we can see hidden files from pendrive


go to cmd(command promt)
and write the drive name of pen drive and then write the command as follows:
attrib -s -h /s /d *.*


for example:

J:
attrib -s -h /s /d *.*


Here, 'J' is the drive name.. while writing the command take proper care of the spaces...attrib then space then -s then space then-h then space then /s then space then /d then space then *.*

Saturday, 17 August 2013

static charge detector

 Current leakage detector

Introduction:

This is a static charge detector circuit.It detects the leakage of charge from any circuit,mains,within walls,etc.

Now a days wiring in houses are done within the walls and in the condition of charge leakage it becomes impossible to detect where is the fault.In such cases the whole wall has to be broken down for repairing.

This causes loss of time and money.It is a major problem in almost all building and appartment in this modern age.

To provide beautification to houses,flats and shops the interior wiring is done within walls but during the problem in electric faults it also causes heavy loss of money.

 
Circuit:

Components: 1) resistors(100k,100k,220k)

                        2) 3 transistor BC547

                        3) 6v dc supply

Description:

 

 Here 3 BC547 transistor are used.

the emitter of every transistor is connected to the base of other.

at the place of detector you have to use any metal or conductor.Here the 3 transistor are used with 3resistors

220k resistor is used at last transistor to provide perfect voltage drop across the Led to make it work.

other two transistor is used with 100k resistor.

Here the circuit works on the principle of charge gain the charge detected is multiplied by gain to give the result in form of led glow.

the gain is simple 100k*100k*220k

the detector is capable of detecting any static charges.

 For any further assistance or problem kindly comment below,

We appreciate your comment and feel pleasure in answering your queries because it makes us gather more knowledge and improve our post.

Wednesday, 7 August 2013

wireless remote control car


WIRELESS REMOTE CONTROL CAR


 REQUIREMENTS:   
                               1) ASK TRANSMITTER RECIEVER PAIR(100mhz
                                2) HT12E(ENCODER)  AND HT12D (DECODER)
                                3) 750K,33K (RESISTORS)
                               4) 0.01UF (CAPACITOR)
                               5) 2PIECES  9V  BATTERY
                              6) 4 PIECES OF WHEEL 7CM DIAMETER
                              7) 4 PIECES GEARED MOTOR 500RPM
                              8) A PIECE OF PLYWOOD(SQUARE)


 CIRCUIT DIAGRAM:

 


 CIRCUIT EXPLANATION:



 

THE RED LINE IN THE CIRCUIT DIAGRAM IS THE ANTENNA.



PIN NO. 1-9 OF BOTH ENCODER AND DECODER IS GROUNDED SO THAT THE ADDRESS



OF BOTH ENCODER AND DECODER REMAINS THE SAME.



2 DPDT SWITCHES ARE REQUIRED



THE CONNECTION OF DPDT SWITCHES IS DRAWN IN THE DIAGRAM.



THE +VE OF THE SWITCH 1 IS CONNECTED TO D0 AND THE -VE IN D1



SIMILARLY THE +VE OF SWITCH 2 IS CONNECTED TO D2 AND THE -VE IN D3



PIN 14 IS ALSO GROUNDED.







DONT GET CONFUSED WITH THE +VE AND -VE OF SWITCHES WHICH IS TO BE CONNECTED TO THE 9V BATTERY.



SEE THE DIAGRAM CAREFULLY AND UNDERSTAND IT.







SAME 9VOLT BATTERY CAN BE USED FOR SWITCH AND TRANSMITTER CONNECTION.







IN THE TRANSMITTER AS WELL AS RECIEVER PART THAT IS HT12E & HT12D, A OSCILLATOR IS CONNECTED WITH PIN 15 AND 16 THEREAFTER THE RESISTORS ARE CONNECTED.



IN THE RECIEVER A434 PIN 6&7 IS SHORTED AND CONNECTED TO PIN 1 AND THEREAFTER GROUNDED.



PIN 2 IS CONNECTED TO PIN 14 OF HT12D



PIN 3 IS CONNECTED TO PIN 17 OF HT12D



PIN 4&5 IS SHORTED AND CONNECTED TO PIN 18 OF HT12D



OUTPUT FROM PIN 13 IS CONNECTED TO  +VE POINT OF BOTH THE WHEEL OF ONE SIDE OF CHASIS



 AND OUTPUT FROM PIN 12 IS CONNECTED TO -VE POINT OF BOTH THE WHEEL OF ONE SIDE OF CHASIS



OUTPUT FROM PIN 11 IS CONNECTED TO  +VE POINT OF BOTH THE WHEEL OF OTHER SIDE OF CHASIS



 AND OUTPUT FROM PIN 10 IS CONNECTED TO -VE POINT OF BOTH THE WHEEL OF OTHER SIDE OF CHASIS



  CONTROLLING OF CAR:


 SWITCH 1               SWITCH2                        MOTION

 FORWARD              FORWARD                       FORWARD

 BACKWARD           BACKWARD                    BACKWARD

FORWARD                OFF                                    RIGHT TURN

OFF                            FORWARD                        LEFT TURN

FORWARD                OFF                                      360 DEGREE TURN


  EXTRA THEORY:


  EVERY SIGNAL CAN BE TRANFERRED OVER THE SPACE IN A FORM OF 0 AND 1 WHERE 0 REPRESENTS LOW VOLTAGE AND 1 REPRESENT HIGH VOLTAGE.

HERE ENCODER ENCODES THE INSTRUCTION IN 0 AND 1 FORMAT AND THE DECODER AGAIN DECODES IT TO INSTRUCTIONS TO BE PERFORMED.

 TRANSMITTER IS THE ONE WHICH TRANSMITS THE ENCODED SIGNAL AND RECIEVER IS THE ONE WHICH RECIEVES THE TRASNMITTED SIGNAL.

THE TRANSMITTER   HAS 8 BIT ADDRESS BUS WHICH IS PIN NO. 1 TO 9

AND SIMILARLY RECIEVER HAS 8 BIT ADDRESS BUS FROM PIN NO. 1 TO 9.

SO HERE BOTH ARE GROUNDED FROM PIN 1 TO 9 SO THAT THE ADDRESS REMAINS THE SAME.

IF THE ADDRESS IS NOT SAME THEN THE SIGNAL TRANSMITTED IS NOT RECIEVED BY THE RECIEVER.
 

  FOR MORE KNOWLEDGE ON ENCODER,DECODER FOLLOW DIGITAL ELECTRONICS BOOK BY ANAND KUMAR OR RP JAIN.

AND FOR TRANSMITTER-RECIEVER  FOLLOW ANALOG COMMUNICATION BY BPLATHI &AK LATHI OR SANJAY SHARMA





 
  THE CIRCUIT IS MADE AND TESTED BY ME, IF YOU HAVE ANY PROBLEM REGARDING THE CIRCUIT THEN PLEASE COMMENT BELOW.


ratan.singh@ieee.org

About the author

Scholar Ratan pal singh is a Google scholar, a man with innovative ideas and a nothing is impossible attitude, is a tech-lover.
He works as a independent researcher and freelance website and software developer.
Member of IEEE comsoc society, Green technology society and has published research paper and codes in many international journals and opensource.

"Failure is the pillar of success and Honesty with oneself is the only true way of achieving self-confidence."

Translate

Pageviews