How the software control the hardware?

Discussion in 'General Electronics Chat' started by ajerk, Aug 27, 2006.

  1. ajerk

    Thread Starter New Member

    Aug 27, 2006
    2
    0
    How the software control the hardware?(through Current or Voltage?)
    When a unmanned car running remotely controlled by a man or by itself,
    what happened between the software and hardware(C code,Operation System,tyre,engine,radio,any interface?).
    How they are interactived?
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,178
    1,799
    The hardware actually controls itself by the repeated execution of sequences of simple operations. These sequences of simple operations are created by a programmer and rendered into strings of bits for the hardware to process. The simple process is as follows:
    Code ( (Unknown Language)):
    1.  
    2. Begin:
    3.   Get a string of bits
    4.   Do the operation defined by the string of bits
    5.   Goto Begin
    6. End:
    7.  
     
  3. ajerk

    Thread Starter New Member

    Aug 27, 2006
    2
    0
    How the code (between Begin..End) control the move of a vehicle?
    Thanks!
     
  4. Papabravo

    Expert

    Feb 24, 2006
    10,178
    1,799
    The code between Begin..End is an abstaction, it lacks details. It can however be improved and refined. We can do this on many levels and with many different forms of expression. Ultimately those different forms of expression are reduced to stings of bits that the hardware can interpret. The hardware cares nothing about the actual content of the bit strings; like a slave in guano mine it does what it is commanded to do. To understand how a vehicle is controlled you may need to take some smaller steps.

    Consider the humble LED and a resistor. Connected to a port pin on the processor it is either ON or OFF. Imagine there is a bit string that will turn the LED ON and another one that will turn the LED OFF. Imagine there is a string that will wait for some number of milliseconds. Imagine there are strings that alter the sequence of strings that the hardware schedules for execution.

    Code ( (Unknown Language)):
    1.  
    2. Begin:
    3.   Wait for 500 milliseconds
    4.   LED ON
    5.   Wait for 500 milliseconds
    6.   LED OFF
    7.   GOTO Begin
    8. End:
    9.  
    What will you observe? The LED will flash on/off at a 1 Hz. rate. It's a nearly trivial example, but in vehicle control you have to start somwhere. Turning things on and off and measuring time are basic building blocks.
     
Loading...