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

202   COUI|IING  PULSES:  A PnOGRAiIIIIABLE  TACHO ETEB



                    urPli'ii!!n.1!.{li:  Finished  pulse  counling  Program
                     CI,EAR
                     DEFITiIE  OSC  4

                        The  followinq   are  lhe  lnages  of  the  nwbers   and  are  srored  in

                        befoie  we  do  anythins  else.  These  {ilL   be  Placed   in  PORTB to

                        nunber  for  each  digit.
                      r'tRME  1999, %11111111                LED  iS  Lii
                      lrRxTE 2000, % 0 0 0 0 0 1 1 0          0
                      wRxtE  200L. %10111110                  t
                      VTRITE  2 OO2, %01001100                2
                      WRITE 2003, % 0 0 0 1 1 1 0 0           3   for  our  parlicuLar   wirinql
                      wRrtE  2004. %10110100                  4   setup  this   deflnes  lhe
                      wRtrE  2005, %00010101                  5   ren  digits   lhal]  te  need,
                      !rRME  2005, % 0 0 0 0 0 1 0 1          6
                      wRrrEE  2007,  r"10011110
                      r,tRrrE  2008,  %00000100               8
                      $RITE  2009, % 0 0 0 1 0 1 0 0          9

                      TRIsA=e"o0010000
                      ERIsB=%00000000
                      P  VAR  BYTE
                      X  VIR  BYIA                counter  variable
                      A  VAR  BYTE                coluter  variabLe
                      Z  VAR  BYTE                counLer  variable
                      Q  l/TR  BYTE               counter  variable
                      ?ULSE_I,EN   VAR  WORD
                      VAI-IE   VAR  WORD          value  of  neironone   counts
                      TOIIAI-  VAR  WORD          value  of  netronone   counts
                      DIGIT1   VAR  BYTE          each  disit   in  disPLaY
                      D!GIT2   VAT  BYTE          each  digit   in  disPlay
                      DIGIT3   VAR  BYTE          each  dilrir   in  displaY
                      DIGIT4   VIR  BYTE          each  diqlit  in  disPLaY
                                                  sets  the  initiaL   walue  for  x
                       P  = { 0 0                 set  pause  will   be  in  nicroseconds

                       Q = 0
                       MAITiI:
                        DIGIEl=-1                             digits   Lo  a  blank
                         DIGI12=-1                            digrits  to  a  btank
                         DIGtT3=-1                            disits   to  a  blank
                         DIGIT4=-1                            disits   Lo  a  blank
   201   202   203   204   205   206   207   208   209   210   211