BS2-ICWe’ve already been introduced to the BASIC STAMP on our BOE-BOT.  A similar chip exists on the BASIC STAMP Homework Board.  I pointed this out in class and called it the brains of the robot.  In fact it is a form of computer called a microcontroller.  A microcontroller differs from the microprocessor in your computer because it has some memory on the chip that allows it to be programmed for a specific task.  The clock speeds of microcontrollers are generally slower than for microprocessor but that’s changing fast.

The BASIC STAMP uses a unique programming language that resides in the left-top chip that has BS2 written above it.  This actual microprocessor is one manufactured by Microchip called a PIC chip.

When these chips first became available to hobbyists they had to be programmed using a programmer that converted a primative computer language called Assembler language into machine language of 1’s and 0’s.

picstartpicrun

Once the chip was programmed it could then be moved into the circuit it was intended to control.

Modern microcontrollers like the BASIC STAMP are able to be programmed and operate on a single board that is programmed through a USB port and has it’s input and output pins easily accessed through headers.

Arduino UNOAt DigiPen, our coach, Brian,  prefers to use another microcontroller called the Arduino.  This microcontroller is extremely popular among hobbyists right now and you will undoubtedly see many at the FIRST competition.  

It uses a USB port (large metal cube on the far left) to program it.  The actual chip that powers it is made by Amtel (the long chip at the bottom) and clocks even faster than the BASIC STAMP (the crystal clock is the oval can on the mid-left side of the board).

Part of their popularity is due to the fact that the manufacturer has produced a number of interface boards called “shields” that clip onto the headers.  These can be used for wireless communications, motor control or any other interface you might need for your robot with little need for peripheral chips or discrete components to support it.

The LEGO robotics kit we have uses 3 Amtel microprocessors.  One for communication, one is the main microprocessor and the last one is dedicated to motor control.  Of all the microcontrollers we’ll be using it is, by far the most advanced.  Fortunately the interface only gives you a few outputs and inputs so you don’t have to consult the technical documents for these microcontrollers to make it work.

Understanding the internal workings of microcontrollers is helpful but not necessary to making a robot work.  What is important is to understand what we’re talking about when we refer to registers, stacks or memory address pointers that our program affects.

The microprocessor depends on a strict sequence of events that transition with each pulse of the clock.  The first thing a microprocessor does is to “fetch” the instruction it is to execute from the program cache one line at a time.  Once the instruction has been read, it is interpreted by the “decoder unit” inside the microchip.  The code can ask for input from one of the microcontroller’s ports, perform an arithmatic function, or place something in temporary memory.  Each of these activities is performed using a bucket of memory for the accumulation of operations, a bucket for what’s called the base, a code bucket and a memory bucket for data.  These are called the Ax, Bx, Cx and Dx registers.  In addition to these the manufacturer of the chip will have a bunch of “Special Purpose Registers” (SPRs) that you can’t change but take memory.  Any of these is manipulated by the code sequence by refering to pointers.  Pointers are simply the memory address that contains the data the program needs.  The pointer moves, pushes or pops data on and off portions of temporary memory called stacks until another call is made to overwrite the memory used in the last operation.

Microcontrollers have varying amounts of on-board memory divided into RAM (random access memory) and programmable memory for holding constants or tables you’ll instruct code to look at.  If your robot is to do anything spectacular, however, you’ll eventually need to access external memory using one of the microcontroller’s ports.

Want to know more

http://www.pictutorials.com/what_is_microcontroller.htm

http://srinivasarao.webs.com/micro-cntrl.pdf

Advertisements