in black and white
Main menu
Share a book About us Home
Biology Business Chemistry Computers Culture Economics Fiction Games Guide History Management Mathematical Medicine Mental Fitnes Physics Psychology Scince Sport Technics

Electronics for dummies - McComb G.

McComb G., Boes E. Electronics for dummies - Wiley publishing, 2005. - 433 p.
ISBN: 0-7645-7660-7
Download (direct link): electronicsfordummies2005.pdf
Previous << 1 .. 101 102 103 104 105 106 < 107 > 108 109 110 111 112 113 .. 149 >> Next

We focus on the microcontrollers for the hobbyist in this chapter. Here, you can discover what microcontrollers are and what they do. In the section “Getting to Know the BASIC Stamp 2,” near the end of this chapter, we give you two nifty hands-on demonstrations that you can try yourself to get a peek at the power of microcontrollers.
So, How Does It Work?
A microcontroller is an integrated circuit chip, which is usually mounted on a mini-PCB that includes other components in circuits that interface the microcontroller to your computer, motors, or switches. When you’re programming TERM LinG - LIVE, infDrmatlVE, NDn-CD5t and ÁĹĎŰ1ĎĹ !
282 Part V: A Plethora of Projects
a microcontroller, you place it on a development board that allows the microcontroller to interface with your personal computer. Once it’s programmed, you mount the microcontroller into a socket on your electronic device.
Unlike traditional circuits, you don’t need to swap wires around or pull out resistors or capacitors and replace them with some other part to change a microcontroller’s function. Instead, you just alter a couple of lines of programming code. The microcontroller seems to take on a different personality, instantly changing what your project actually does. You can program a single microcontroller to do any of thousands, of different jobs!
Most microcontrollers are designed for use in commercial products, and you may find it a bit difficult to program these little guys. Fortunately, some versions of microcontrollers are specifically for the hobbyist, so you get everything that you need to run the microcontroller on one small circuit board.
You can easily program these hobby-friendly microcontrollers, and they don’t drain your wallet.
What’s Inside a Microcontroller?
Originally, microcontrollers were designed to provide a way for a personal computer to communicate with electronic gadgets in the outside world. We still use them for that purpose, and more.
Here are the parts of a typical microcontroller:
Small computer: This computer sits at the heart of the microcontroller. This built-in computer isn’t as powerful as the one on your desk, but microcontrollers don’t need a ton of horsepower. You expect your desktop computer to do several big jobs at once, such as browsing the Internet, calculating spreadsheets, and fending off viruses. The typical microcontroller does a single job.
Non-volatile memory: The microcontroller stores the program that runs on its computer in non-volatile memory. This memory sticks around when you turn off the power. The non-volatile memory comes to life the moment that you connect the batteries and flip the switch.
Input/output ports: These connections on a microcontroller allow it to communicate with the real world, running things like lights, motors, relays, sensors, switches, liquid crystal displays, and even other microcontrollers. These input/output ports, also called I/O ports, provide information that allows the chip to control your project. A microcontroller program may light up an LED when you flip a switch or run a motor when a sensor detects someone walking by, for example.
You can see a good example of a microcontroller in action in the brains of the LEGO Mindstorms robot construction set. The yellow brick that you can see term LinG - live, informative, Non-cost and Genuine !
Chapter 13: The Exciting World of Microcontrollers 283
in Figure 13-1 contains a small microcontroller chip that can display messages on a liquid crystal display (LCD), react to switches and other sensors, and run up to three motors at the same time.
As with all microcontrollers, you program the LEGO Mindstorms’ brain by sending it programming instructions. First, you create these instructions on your personal computer, and then you transmit them to the Mindstorms brain by using an infrared link (most microcontrollers that hobbyists work with use a wired link that you connect to your PC’s serial or USB port). After you send instructions to the microcontroller, the instructions reside in non-volatile memory until you replace them with new instructions. LEGO Mindstorms gives you a good example of a microcontroller’s ability to play multiple roles; you just have to modify the software. By changing a few lines of a program, a LEGO Mindstorms robot can do the following:
^ Search for the brightest light in the room, such as a flashlight, and move toward it.
^ Find the brightest light and, instead of approaching it, move away from it.
^ React to bumper switches mounted on its sides so that when the robot hits an obstacle, it backs up and goes the other way.
^ Sense a black line on a piece of white construction paper and follow it.
The LEGO Mindstorms, like the little robot in Figure 13-2, can also follow a combination of several of these functions. This little ‘bot can follow a bright light and back up from obstacles that it bumps into.
construction kit contains
Figure 13-1:
The brain of the LEGO Mindstorms
Previous << 1 .. 101 102 103 104 105 106 < 107 > 108 109 110 111 112 113 .. 149 >> Next