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

BLINKEIGHI LEDS l|{ SEOUET{CE 5l



                  SetTRISD to  %l1111110 fi$r to set all lines  1() inputs excepr D0.  which is shown as rhe
                  only  pin  set to bc an outpur.)
                    We  will usc binary notation  ('/.11110000)  for setting  all  pins,  pors, port  directions,
                  and rcgister values thro ghout  this book, though  you  can use hexadecimal  ($F0)  and
                  decimal  (DEC 240) notation interchangeably.  Using bindr.y norarion  lets you see what
                  each  pin  i\ doilg  wIhoul  hr!ing ln m"le .rn) co ref.ior\.



                  Blink Ei t LEDs  in S uence


                  ID Program  5-2, we blintr the eight rightmost  LEDS on the bargraph,  one LED aratime.
                  The circujtry  we are using for this  progran  is shown in Figule  5.2. We do this  by set
                  ting PORTD  to I and then multiplying  il by two a toral  of eight times to move the lighrcd
                  LED left one  position  in each iteration. Nore rhat  the last multiplicarion  ovcrflows the
                  ll bit counter and turns all thc LEDS OFF












                                          @l
                                   tMac-''
                                    :r  :il









                                    ::r ::3












                                                -       :      =
                                   LED bargraph chcuihy  to all of PORTD.
   56   57   58   59   60   61   62   63   64   65   66