[Book]
Main Page |Book|Search:
[Add to or Correct This Page]

Microcontroller Connections

Hello

The “Hello World!” message of the microcontroller is a blinking LED. Once you get the microcontroller to blink an LED, you have proven the mastery of the general environment. Be aware that the environment is sometimes the hard part. After getting accomplising this trivial project, the particulars of your grand project may seem easy in comparison. You will have to make connections to to the microcontroller for power and programming. That will be covered here. You will also have to connect up an Led and write a program for [digital ouput], those are covered on the programs and circuits page.

Identifying the Pins of the Microcontroller

In the documentation of your microcontroller’s documentation, you’ll find a diagram and chart describing the different jobs that each pin does.We refer to this diagram so often that we usually photocopy it and put it on the wall. Every microcontroller will have pins for connecting to power and ground, pins dedicated to programming the chip, and general input and output (I/O) pins. Some microcontrollers will have give special function of a subset of pins, for example ADC, PWM or Serial. In software, you will set which task you want a pin to do.

Microcontroller in the breadboard

Breadboard Power

In this secvtion weyou will be using a voltage regulators to supply ground and 5-volt power to thosethe long strips of holes on the sides of your breadboard. Some breadboards have power on one side and ground on the other, but it is more convenient to have both power and ground on both sides.

Power Supply

We will discuss a couple of ways to connect power to your board. For all of them, however, you will have to be able to identify the positive and negative leads of your power supply. This process was described in the previous section, [Using on using a Multimeter]. Mark the leads with tape or a marker so that you clearly remember which is positive and which is negative. After you have established which wire is which, unplug the power supply again before you start connecting it to your board.

Power Connector

If you want a more professional power connector that will allow you to disconnect your power adapter safely and reuse it for other projects, build a power connector infor your circuit. The easiest type of connector is a 9-Vvolt battery snap, as shown in Figure 3.16 (fourth froorm left). They Battery snaps attach nicely to 9-Vvolt batteries but not very well to standard power adapters. It is also easy to accidentally reverse the polarity with thesebattery snaps, and that which can fry a voltage regulator.

Chip Power Connectors

Most of the circuits you’ll build on a breadboard, even the ones with no microcontroller, are likely to work at 5 volts. It’s so common, in fact, that most high and mid level microcontrollers (eg for example, Basic Stamp, BX-24, and Basic Atomm Pro24) come with a 5-Vvolt voltage regulator built in. These regulators allow you a little bit of latitude in the voltage you supply (from 8 to 15 volts DC), converting whatever you input to 5 volts DC. Next, you distribute the 5 Vvolts and ground to the side rows of your breadboard.

External Voltage Regulator

The voltage regulators that come with the microcontrollers are a little weak. They are easily fried by a brief short circuit or reversed polarities. If this happens, putting in an external voltage regulator will probably revive your microcontroller. Better yet, skip this drama and put inuse the an external voltage regulator in from the start. If you are using a lower level microcontroller you will need an external voltage regulator from the start. If you wired it incorrectly, your regulator probably overheated and produced a puff of smoke. Let it cool down, throw it out, and try again with another regulator. It is normal for a powervoltage regulator to get a little hot if it operating at the high end of its range., Tthat is why it has that metal fin on top to dissipate the heat. If you have something resembling the dreaded short circuit your regulator could heat up to the point of giving you a little burnwhere it burns you when you touch it. Let it cool down, throw it out, and try again with another regulator.

Decoupling The Power Suppy

You can probably skip this step but it is recommended to use capacitors to "decouple" or smooth out your power supply. This is particularly important when powering inductive loads like motor. It is not a bad idea any time. If your microcontroller is continually restarting (you can determine this by putting a debug statement above the main loop) decoupling your power supply may help fix things.

Getting Your Program to the Chip

There are a couple of steps common to all microcontroller programming environments, editing your program, compiling, downloading, running and debugging. One of the great advantages of stamp-like chips is that all of these capabilites are build into a single software package that is freely downloadable from the manufacturer. For a pic, you might have to get four different pieces of software to work together to accomplish the same task. Transferring the program to the microprocessor is usually a one-way journey, it's not possible to get it back. Make sure you keep track of the text files that you create on your multimedia computer because they will be your only copy of your programming. The software for programming all of the microprocessors we’re discussing exists for Windows PC’s only (though there is one a Macintosh-based programming environment for the BasicBASIC Stamp 2). Once you’ve programmed the computer, you can communicate with a Macintosh computer from your microcontroller, however. It is possible to use VirtualPC to run for the programming software for all of these microcontrollers on a Mac, but there are a number of technical difficulties to be overcome to make that happen. The programming environment does not require a very powerful computer, so some Mac users prefer to just pick up an old PC from a junk store or eBay and use that just for programming their microcontrollers.

Programming Hardware Connection

The first four pins of Stamp-like modules form a serial port that connects to the RS-232 serial port of your multimedia computer. We generally make a serial connector that translates from a standard DB9 cable to the breadboard. The serial cableStamp-like module connects via a serial cable to the serial port on your multimedia computer. Look for a port on the back of your computer with a 9- pin male connector (DB9) labeled “|0|0|1” or “COM1.”. On very old machines, the connector has 25 pins. Nowadays many machines (Mac and PC) are only equipped with a USB serial port. For those, you’ll have to get a USB-to-RS-232 adapter.

[Add to or Correct This Page]|[Yes, this is a Wiki]