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

CFEATII{G OUTPUTS  49


                   which  is  provided  on rhe LAB-XI,  and then  move on ro using  the speaker  anal an R/C
                   hobby  servo.
                                             "luming
                     Lefs start with tlrc standard   an LED ON and OFF, program.  We will use
                   one of the LEDS  in the ren  LED bargraph  tharis  provided  on the  LAB,XI.  We  have
                   control  of only the eight  righlrnosr LEDS  on this  bargraph. The lefmost LED is thc  power
                   ON indicator  and the  one rcxr to it cones  ON if we were  using a common  calhocle
                   affangement  for the bargraph  (as  opposed to the common  anode an aigemen!  as it is cur
                  rently  configured).
                     Thc  cirouitry  we are inrerestcd  in is shown  in Figure  5.1. AI  other  circuitry of the
                                                           ir so
                  LAB X I is still in  place,  but  we have suppressed  we are not distracted  by it and  can
                  concentrate  on the LED that is of interest  to us.  (PORTD.o).  PORTD.0  refers to bit 0 oI
                  PORTD.
                    In our lirst exercise,  we want ro control rhe rightmosr  LED of the LED array. This is
                  connected  to bit 0 of PORTD in the circuirry  showD in Figure  5. L Our  progran  needs
                  to tum this LED ON ard OFF !o demonstrale  thar we have  complere  conrrol of rhese















                                    5

                                    3
                                    io



                                    1 5          26

















                   Flgurc  5.t   The  LED bargraph  chcuilry  for POBTD  pin  O.
   54   55   56   57   58   59   60   61   62   63   64