Page 123 - Robots Androids and Animatrons : 12 Incredible Projects You Can Build
P. 123

As the name implies, a single-chip computer is an entire computer
                                system that lies within the confines of an integrated circuit (IC) chip.
                                The microcontroller existing on the encapsulated sliver of silicon has
                                features and similarities to our standard personal computer (PC).
                                Primarily the microcontroller is capable of storing and running a pro-
                                gram (most  important  feature).  The  microcontroller  contains  a
                                central  processing  unit  (CPU),  random  access  memory  (RAM),
                                read  only  memory  (ROM),  input/output  (I/O)  lines,  serial  and
                                parallel ports, timers, and sometimes other built-in peripherals
                                like analog-to-digital (A/D) and digital-to-analog (D/A) converters.

                        Why use a microcontroller?

                                The  microcontroller’s  ability  to  store  and  run  unique  programs
                                makes it extremely versatile. For instance, one can program a micro-
                                controller to make decisions (perform functions) based on prede-
                                termined situations (I/O line logic) and sensor readings. Its ability to
                                perform math and logic functions allows it to mimic sophisticated
                                logic and electronic circuits. Still other programs can make the
                                microcontroller behave like a neural or fuzzy logic controller.

                                The output of the microcontroller can control direct current (DC)
           102                  motor drives [using DC or pulse-width modulation (PWM)], servo
                                motor  positioning,  stepper  motors,  etc.  Programming  a  robot’s
                                microcontroller to respond to sensor readings or a communication
                                link creates an intelligent, responsive robot. Microcontrollers are
                                responsible  for  the  “intelligence”  in  most  smart  devices  on  the
                                consumer market and will be the intelligence in our robots.

                        PIC programming overview

                                Programming PIC microcontrollers is a three-step process. Before
                                you can program, however, you need to purchase two items, the
                                PICBASIC compiler program and the EPIC programmer (a program-
                                ming carrier board). These two items do not include the PIC micro-
                                controller chip or its support components. I recommend beginning
                                with the 16F84 PIC microcontroller because it is a versatile 18-pin
                                chip with 13 I/O lines and rewritable flash memory. This flash mem-
                                ory  allows  you  to  reprogram  the  PIC  microcontroller  chip  1000
                                times. This is really useful when testing and debugging your pro-
                                grams and circuits.
                                The PICBASIC compiler (see Fig. 6.1) runs on a standard PC. The
                                program may be run in DOS or in an “MS-DOS Prompt” window in
                                the Windows environment. Hereafter the MS-DOS Prompt window
                                will be referred to simply as a DOS window. The DOS program will
                                                       Team LRN
            Chapter six
   118   119   120   121   122   123   124   125   126   127   128