# Is interacting with registers the only way software and hardware interact?

I'm aware that memory mapped addresses that point to registers are sometimes used to control hardware devices. Is that the only way they're controlled? I started asking about how software talks to hardware and most people told me about using registers and memory addresses to talk to devices. Is that the only way software and hardware interact? Thanks!

• @jsotola Sorry, I didn't intend to put 3 questions in, I just thought it was the best way to phrase it at the time. Jul 8 '19 at 20:50

most people told me about using registers and memory addresses to talk to devices

Shortly, that is the correct answer - if you are interested how software will (ultimately) talk to hardware. How hardware can have an impact on software, things get a lot more complicated.

If you want to understand deeply how things happen, you should study how micro-controllers are implemented. Studying the famous 8051 is a very good start, and there are countless books and articles about it. You will have the chance to understand timers, interrupts, ports, buses...

• Ok, I'll go pickup some 8 bit MCUs and see how they work. Should I just work up in complexity from there until I reach modern 64-bit CPUs? Jul 8 '19 at 20:52

No. You are talking about memory-mapped I/O. It means that the CPU see the hardware as if it would be some like a memory module.

All the robots have these three components:

1. a controlling mechanism. It means a collection of chips.
2. sensors (to know the world around them).
3. and motors (or, more generally, end-effectors. For example, a robot capable to heat its arms has a non-mechanical end-effector).

(1) gets the data from the sensors (2), and using the collected data, says to (3) what to do.

All the chips have a set of pins. They can send voltage to them, or they can read the voltage on them send by others. The sensors and the end-effectors use electronical (or physical, chemical, anything) means to convert between the voltage on the pins and the external world. This might be quite complex, for example until the $$\mu A$$, 5V current becomes a regulated 3-phase, 50Hz, 380V current on a large industry robot, the steps are not trivial.

But this all is not important. The only important thing is that the CPU has to communicate somehow with the other chips/devices of the robot, and the only question is, how do we call the pins and what type of pins are on which the communication is going on.

A simple way, with some disadvantages, if the CPU see the hardware, as if it would be a memory block. If you write a data to a specific memory address, you send data to a device.

Another possibility is to have dedicated pins for I/O, it is the port-mapped I/O.

Mainly large mainframes had also specific I/O coprocessors, i.e. mediating chips only for I/O tasks.