Page 54 - Making PIC Microcontroller Instruments and Controllers
P. 54

ptcBAsrc  Dno coflDtlEn



                   and thus willhave the manual for the  compi  ler  in hand. However, some commands can
                   be complicated to implement and so we will  spend time on them as necessary.
                     The compiler is kept  cunent by miuoEngineering l-abs. fbr the latest MCUS rcleased
                   by Microchip  Technology. The LAB-XI  uses the 16F877A MCU, and it is the MCU of
                   choice, though ot}er MCUS that have a general pin-for-pin  compatibilily with this
                   MCU may also be used. Al1 the experiments  and exercises in this book will  use ihe PIC
                   16F877A only. The compiler addresses almost all the capabilities of this MCU, and we
                   will  cover the use  of all the devjces  provided  on the LAB-X I board to develop the com-
                   forl level you need to incorporate  them into your instruments afld contro]lers.
                     Detailed instructions  lor installing the software on  your  PC arc  prcvided  in the compiler
                   manual.  It is not necessary to install the software from a DOS  prcmpt.  It is much  easier to
                                              '
                   install it under Mndows with the  Install.exe"  or equivalent file provided  jn  each  package.
                                                  "one
                     The software can be set up so  that   mouse click"  will  transfer the  program  liom
                   the editor to the PIC microcontroller and run the  program  in the PIC. In oder to do this,
                   you have to add a couple of functional codes to the programner operating system.
                   These codes tell the  programmer  to load the  prcgram  and execute it. Installing the soft
                   ware is covered in detail in the chapter on gefting stafted.

                   A SIIiIPLE EXAIIIPLE PROGRAM USII{G PICBASIC

                   A program  that makes  the LEDS blink ON and OFF is usudlly the first program  writ-
                   ten by beginners. The  pupose of the  program  is not to blink the LEDS  but  rather to allow
                   you to go through the programming procedures  in a simple and straightforward way,
                   and  get  a result that is easy to verify. Once  you have  the LEDS blinking, you will  know
                   you have followed all the steps necessary to write and execute a  program,  Larget morc
                   complicated  programs  may be m  ch more  difficult  to write and debug but they are no
                   more difficult to compile,load,  and run.
                                                                         "blin}"
                     Progmm 4.1  outlines the keystrokes for writing and nnning tlle   the LEDS  pro-
                   gram  in PICBASIC.

                   1i!aii0a!i!1{i!i   The rlrst  program  (Blinkins  all eishi LEDS on PORTD  one ai a  tlme)


                                      nyBtinkSleds   .  BAS
                                      Harpri!   Singh  Sandhu
                                      Copyriqht  o  2008
                                      A11  Riqhts  Reserved
                                      1 /  F e b / 0 A B
                                             2
                                      1 . Q



                    CI;EAR                     ,  clear   FnM nenory
                    DEFINE  OgC  4             ,  define  the  osc  freq
                    I.ED  ID  VAR  BYTE                ouE !!e  two  d..lablec  LfD  ID  and  t
                    t  VIR  BYTE               ;  as  8  bi!  bytes
   49   50   51   52   53   54   55   56   57   58   59