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

PULISES! PROGnA  iIABIE TACHOMETEF
             taA   COUNTIIIG      A



























                    i:t!!!i-iltfgif::   A programmable  tachometer.



                     out  at times.  When using a LAB-XI,  we know  we have a working  platiorm to develop
                     the software  without having to worry about hardware  problems that we might have cre
                     ateal lor o  rselves. After we have the tachometer  software  workng. we can use the  LAB-
                     Xl  to create  pulses  generated  at known  frequencies  to check the accuracy of the
                     instrument  we created,
                                                                 dispiays  has to do with leamjng
                       The displaying  of the counts  on 4 seven-segment
                     how to use these  commoniy  used and inexpensive  displays.It  is, ofcourse'  much easier
                     to display  the information  on the  2 x 20 LCD on  the LAB Xl,  but in this exercise  we
                     will  be using th.- LAB-XI  only as our initial software  platlbml. If you prefer the  proj
                     ect can easily  be modified  to rul1 on the  LAB  -X  1, but then  you will  miss  out on the  expe-
                     rience oflearning  how to use  the seven segment  displays.  In any case' the  PIC we use
                     will be lhe l6F8??A.  (This  PIC will be employed  for all the  projects in this book' and
                     the LAB  X1 will  be used to suppoft  all the  projects  as needed  )
                       The facl that we ar€ using only four displays  is because the  integer math  provided  in
                     the compi  ler can handle  only 16 bit math  (65535  max),  which limits  us tofourdisplays
                     if we want  to go to a 9 in the Left-most display.  It also simplifies  our  problem  at this stage
                     anal will  demonstrate  that  refreshing lbur di splays  takes us  to the ma,\imum  that the PIC
                     can  confol  (at  4 MIIZ) without having to use assembly  language  programmj ng lt is also
                     a compronr.ise  that has to do with the fact that four digits can be handled  easily with
                     one  dnd a half  pofts (12lines.|.
                       We will  be using a small dc motor with a  2o-slots-per revolution encoder  (available
                                                    on it as our signal  gencrator  (see  Figure  I 5 -2), but
                     from  my Website  encodergeek.com)
                     before  we do that we need to undertake  some  general  discussion about  counting  pulses
                     and what the  problems related with low and high  "counts/time  penod" are. If  you have
                     some other device  tha! can  generate pulses,  you can use  it if you like.
   187   188   189   190   191   192   193   194   195   196   197