software and hardware interaction

Started by
22 comments, last by xeyedmary 7 years, 4 months ago

I would like to gain a some knowledge on the control of hardware, say a monitor interacting from an operating system, What is the lowest level like and how does the software do this?

Thank you,

Joshua

Advertisement

It all depends on how far down you want to go. Modern electronic digital computers use semiconductor transistors as digital switches to control the flow of electric current in an on/off manner to encode Boolean alegbra. The Boolean algebra can be mapped to the symbolic manipulation of information. We can provide ways of translating that information to and from more traditional form of encoding, such as drawing glyphs on paper or with light on a matrix of backlit manipulable crystals. We call this kind of thing a digital computer, digital referring to the fact that it only deals with the digits zero and one as encoded in the on/off state of electric currents, and computer because it computes the result of many algebraic transformations on those digits.

Most modern electronic digital computers are variants of the von Neumann machine. In fact, most machines that people think of as 'computers' are in fact collections of many smaller computers each dedicated to a specific task, almost like it's turtles all the way down.

Inside your theoretical modern general-purpose electronic digital computer there is a collection of logic gates that make up the central logic unit, which interprets data fed to it as a series of instructions. The data is fed from a storage facility sometimes referred to as memory. This is called a stored program machine. Sometimes there is specialized hardware that converts outside information into digital representation so it can be manipulated (and vice-versa), and generally speaking these appear to the rest of the system as specific addresses in memory.

Perhaps the simplest place to start with understanding this low-level hardware-software interaction is by looking at a basic I/O device called a UART, or universal asynchronous receiver/transmitter. It's a very simple version of something like the USB (universal serial bus) in use by many computing devices today.

If you want to know specifically about how information is displayed on a modern monitor, it basically uses something like a UART above to transfer the contents of a large chunk of contiguous memory to the monitor itself, which maps that data into brightness levels of areas on a screen.

If you want to know how the data to be displayed on the screen gets composited from input data like vertexes and textures and stuff, that gets pretty darn complicated pretty darn fast. Worth studying up on though.

So... what was it you wanted to know, exactly?

Stephen M. Webb
Professional Free Software Developer

Do you have a particular piece of hardware you'd like to interact with?

Are you trying to make an OS?

Depending on what you want to do a good place to begin might be the Windows DDK (driver development kit).

Alongside the DDK data sheets and programming guides for certain chips that are in certain products would be a good read.

Another good place to start might be OS programming websites, or old DOS based programming books/sites since the OS didn't protect hardware access.

Become familiar with terms like interupts, DMA, MMIO, and I./O address space.

But basically reading and writing to special registers and memory areas which are mapped to the CPU address space is how its done. But each piece of hardware is different in how its controlled. For example AMD video cards are controlled differently than nvidia video cards and USB ports are still different to both those (and different brands of USB are different.

-potential energy is easily made kinetic-

Try taking a look at some sites like osdev.org, which will provide you with a wealth of information and even source code as low level as it's possible to go without creating your own hardware or flashing the bios with your own code (neither really recommended these days).

Let me know if this helps!

Buy an Arduino or Raspberry Pi

I would like to gain a some knowledge on the control of hardware, say a monitor interacting from an operating system

Interacting with a OS implies writing a kernel device driver, that's an entire world in itself.

What is the lowest level like and how does the software do this?

Before you look at the computer side, it probably pays to look at the electroncs/hardware side too. Simple entries in this field are Raspberry PIs or Arduino boards (and probably others, any single board processor card will do, picking a popular one means you'll have a lot of answers available from the Internet). Their OS is small or even non-existing, but for experimenting with hardware devices that's ideal.

Edit: Ninja'd by Hodgman

Thank you everyone I'm not developing an OS just interested. What I'm wondering now is how a software program's command result becomes a digital signal to the semiconductor?

Thanks again,

Joshuae

Anything your high-level program does is never interpreted directly by hardware in a modern system.

Even what you visualise as machine code opcodes are just handled by microcode, interpreted at some level within the cpu to a more pure form...

A modern pc is like a huge game of "Chinese whispers", where each layer whispers a command to the next which is reinterpreted into a more suitable form.

Assuming you're running a c++ program on Windows 10, there are probably about 15 layers between you and the hardware. If you're executing .NET CIL code, many more layers exist on top of that.

It's important to only concern yourself with the layers that immediately concern what you want to achieve as there's many man-centuries of code and computer science between you and that discrete electronic signal bouncing around transistors.

Hope this helps!

what I mean is the signal from the programming command to the actual computer. Maybe this is a different answer. I am at the level of how does a command turn into any sort of electronic signal.

Thank you,

JoshuaE

DAC (digital to analog converter) is what you're looking for. In the case of video cards its the RAMDAC.

-potential energy is easily made kinetic-

This topic is closed to new replies.

Advertisement