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

NOTES O  USII{G SEVEN.SEGMENT DISFLAYS





                  c6
                  c7















                  B3


                  84
                  B5
                  B6
                  97
                  l]fjEr{ttlal9;9..i  One  way of wiring for the seven-segment displays as






                                                             subroutine so it can be callcdby a
                    The display rouline  is wrilten as  a  self-contained
                  relativelyfiequentinrer.rpltokccpth.3djsplayalivewhilealongandcomplicatedpro
                  gram goes  about doing ils work.
                    Program 15.2, with a bit more code. rcplaces *rc code lbr the  LCD in the original
                  program.  The complete  program  is listed after the wiring diagrams and some  seven-
                  segment  rclated notes  that  follow



                  Notes            Usins      Seven-Sesment
                             on
                  Displays


                  The lighting of the displays  is somewhat  like the reverse of scanning a keyboard.  The
                  segnents thal are lit represent thc  rcverse  oflhe keys that were  pressed.  In eilher casc,
                  the scan idenliljes eithcr a displayed set of segments  or a key- Most scanning roulincs
                  serve similar lunclions and arc  implcmcnted in this same way.
                    Lefs wite  a short routinc to light all the segments  in a seven-segnent display onc
                  segment at a time. Assume thal the scvcnscgments and the deci  mal  point  are connecled
                                                                           a common arode
                  to PORTB. The common line is attached to PORTA.I. Lct's assLrme
   198   199   200   201   202   203   204   205   206   207   208