Page 169 - PDA Robotics Using Your Personal Digital Assistant to Control Your Robot
P. 169

PDA 07  5/27/03  8:44 AM  Page 145
                                 the oscillator calibration word programmed by the factory into some
                                 devices.  Chapter 7 / Programming the PIC16F876 Microcontroller
                                 The Erase speed button will erase EEPROM or flash electrically erasa-
                                 ble  devices.  It  is  grayed  out  for  devices  that  cannot  be  electrically
                                 erased.
                                 The Device box allows selection of the device to be programmed. Click
                                 the down arrow to the right of the box to drop down a list of support-
                                 ed devices, then click on the device. This device information, includ-
                                 ing the default device that is selected on start-up, is contained in the
                                 file EPIC.INI. This file must be in the same directory as EPICWIN.EXE.
                                 Select the device before a .HEX file is opened to ensure the configura-
                                 tion  information  is  properly  interpreted.  Devices  with  parentheses
                                 after them indicate that they will program either the base version of
                                 the part, or the version contained within the parentheses. For exam-
                                 ple, selecting the device listed as PIC16F84(A) means that either the
                                 PIC16F84 or the PIC16F84A may be programmed.
                                 All of the speed buttons, along with other settings, are also available
                                 using the drop-down menus.


                                 The PICmicro MCU Compiler

                                 The code for PIC16F876 used in PDA Robot was compiled using the
                                 PICmicro  MCU  compiler.  The  code  is  written  in  C,  and  will  be
                                 explained in detail in this chapter.
                                 The PCM compiler is for 14-bit opcodes, and PCH is for the 16- and
                                 18-bit PICmicro MCU. This compiler is specially designed to meet the
                                 special  needs  of  the  PICmicro  MCU  controllers.  These  tools  allow
                                 developers to quickly design application software for these controllers
                                 in a highly readable high-level language.
                                 The compilers have some limitations when compared to a more tradi-
                                 tional C compiler. The hardware limitations make many traditional C
                                 compilers ineffective. As an example of the limitations, the compilers
                                 will not permit pointers to constant arrays. This is due to the separate
                                 code/data segments in the PICmicro MCU hardware and the inability
                                 to  treat  ROM  areas  as  data.  On  the  other  hand,  the  compilers  have
                                 knowledge about the hardware limitations and do the work of decid-
                                 ing how to best implement your algorithms. The compilers can imple-

                                                                                               145
   164   165   166   167   168   169   170   171   172   173   174