Programming to control hardware
Moderator: Thanas
- raptor3x
- Padawan Learner
- Posts: 167
- Joined: 2005-07-04 11:34pm
- Location: University Park, PA
- Contact:
Programming to control hardware
So I've come to realize that I don't know even the basics of how to write code to interface a computer with external hardware. I know how to write codes to do FEM, FVM simulations, mesh generation, etc. but how the computer controls the blinking lights on my network card is a complete mystery to me. So, can any computer science (software engineering?) people give me a starting point or list of good books?
The best part of being a mad scientist is never having to ask yourself, "Should I really be doing this?"
"Liberals tend to clump together in places where they can avoid reality and diversity of opinion, like big cities, especially in the east and west coast and college towns." --nettadave2006
"Googles methods are a secret black box and some left leaning folks sit on it's board. I've noticed an imbalance when I search certain other topics related to Obama or other hot button topics, especially in the first page or two of results given.."--nettadave2006
"Liberals tend to clump together in places where they can avoid reality and diversity of opinion, like big cities, especially in the east and west coast and college towns." --nettadave2006
"Googles methods are a secret black box and some left leaning folks sit on it's board. I've noticed an imbalance when I search certain other topics related to Obama or other hot button topics, especially in the first page or two of results given.."--nettadave2006
-
- Jedi Knight
- Posts: 752
- Joined: 2006-10-06 01:21am
- Location: socks with sandals
Re: Programming to control hardware
My experience was more from a bottom up type of learning, so this may not be useful to you, in which case: apologies Ignore.
A good place to start might be to get a basic understanding of digital logic, and maybe the ability to read the various data sheets associated with the hardware you're interested in. Those are kind of important to move into the next step, drivers. Drivers do a couple of things, they manage the low level stuff on hardware (command words and such) and they protect shared resources from over use by multiple threads (the technique I'm familiar with used "semaphores"). For instance if one of your threads were using the modem to send out 20k of data somewhere, a semaphore would prevent another thread from doing anything with the modem until the first thread reported that it was finished sending stuff. I don't think you need a deep understanding of any of those things, but if you can get a basic grasp of those things, you'll probably be ready to start tinkering.
A good place to start might be to get a basic understanding of digital logic, and maybe the ability to read the various data sheets associated with the hardware you're interested in. Those are kind of important to move into the next step, drivers. Drivers do a couple of things, they manage the low level stuff on hardware (command words and such) and they protect shared resources from over use by multiple threads (the technique I'm familiar with used "semaphores"). For instance if one of your threads were using the modem to send out 20k of data somewhere, a semaphore would prevent another thread from doing anything with the modem until the first thread reported that it was finished sending stuff. I don't think you need a deep understanding of any of those things, but if you can get a basic grasp of those things, you'll probably be ready to start tinkering.
The rain it falls on all alike
Upon the just and unjust fella'
But more upon the just one for
The Unjust hath the Just's Umbrella
Upon the just and unjust fella'
But more upon the just one for
The Unjust hath the Just's Umbrella
- GrandMasterTerwynn
- Emperor's Hand
- Posts: 6787
- Joined: 2002-07-29 06:14pm
- Location: Somewhere on Earth.
Re: Programming to control hardware
It's like writing code to anything else. Depending on the environment, it can be as simple as linking in the right DLL and invoking the appropriate manufacturer-supplied access functions. If you're in a lower-level environment, you're going to have to push data into pointers to registers on a memory map. You will have to supply the right words to the device to make it do what you want it to do. All of this is usually found in the SDK for whichever device you're interested in trying to access.raptor3x wrote:So I've come to realize that I don't know even the basics of how to write code to interface a computer with external hardware. I know how to write codes to do FEM, FVM simulations, mesh generation, etc. but how the computer controls the blinking lights on my network card is a complete mystery to me. So, can any computer science (software engineering?) people give me a starting point or list of good books?
The question becomes what sort of hardware are you interested in accessing and on what platform?
Tales of the Known Worlds:
2070s - The Seventy-Niners ... 3500s - Fair as Death ... 4900s - Against Improbable Odds V 1.0
2070s - The Seventy-Niners ... 3500s - Fair as Death ... 4900s - Against Improbable Odds V 1.0
- Dooey Jo
- Sith Devotee
- Posts: 3127
- Joined: 2002-08-09 01:09pm
- Location: The land beyond the forest; Sweden.
- Contact:
Re: Programming to control hardware
You could try, or at least read up on, programming stuff for the GameBoy Advance. There's lots of material out there, and it can be fun. Then you will have to interface "directly" with the hardware by reading and writing directly to certain hardware memory addresses (the memory mapping Terwynn is talking about) in various ways.raptor3x wrote:So I've come to realize that I don't know even the basics of how to write code to interface a computer with external hardware. I know how to write codes to do FEM, FVM simulations, mesh generation, etc. but how the computer controls the blinking lights on my network card is a complete mystery to me. So, can any computer science (software engineering?) people give me a starting point or list of good books?
"Nippon ichi, bitches! Boing-boing."
Mai smote the demonic fires of heck...
Faker Ninjas invented ninjitsu
Mai smote the demonic fires of heck...
Faker Ninjas invented ninjitsu
- Sarevok
- The Fearless One
- Posts: 10681
- Joined: 2002-12-24 07:29am
- Location: The Covenants last and final line of defense
Re: Programming to control hardware
I would recommend finding a easy to use micro controller and starting from there. This will help you get a feel of how software can have a tangible effect on the physical world by controlling simple devices like a light switch or motor.
I have to tell you something everything I wrote above is a lie.
Re: Programming to control hardware
You can get micro controllers these days with built in web servers. You simply connect the controller to your computer with an Ethernet cable and send commands via http. Super simple to use. With a webcam mounted on a servo motor connected to the controller and a free colour tracking addon, I was able to get the camera to track objects. It's been a couple of years since I've messed around with it and I can't remember where I ordered it from, but it wasn't too expensive. There are a number of alternatives that a search on "micro controllers with built in web server" turns up as well.