How the software control the hardware?

ajerk

Joined Aug 27, 2006
2
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?

Papabravo

Joined Feb 24, 2006
16,782
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?
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:
Rich (BB code):
Begin:
Get a string of bits
Do the operation defined by the string of bits
Goto Begin
End:

ajerk

Joined Aug 27, 2006
2
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:
Rich (BB code):
Begin:
Get a string of bits
Do the operation defined by the string of bits
Goto Begin
End:
How the code (between Begin..End) control the move of a vehicle?
Thanks!

Papabravo

Joined Feb 24, 2006
16,782
How the code (between Begin..End) control the move of a vehicle?
Thanks!
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.

Rich (BB code):
Begin:
Wait for 500 milliseconds
LED ON
Wait for 500 milliseconds
LED OFF
GOTO Begin
End:
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.