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

THE OUTPUT  AND NEADING
                 COI{TSOLLIIIG                     THE IIIPUT





                    The oulput  is what we are  iooking for in any insllument lt is the  final result of all the work
                    we  do. We will interactwith  all of the output  deviccs on  the LAB-XI  in these  progrums.


                    BASIC  PROGRAMS
                    t  write  a program to conlrol one  LED on the bargraph
                    ,  Control  all eight  LEDS in the  bdrgraph consecutively
                    t  Dim and brighten  one LED (creating pulses of various  length9
                            'Hello
                    !  Wite       world" to the LCD on its lwo  lines
                    t  Wrirc binafy  and decimal  valucs to the LCD.
                    !  Output a sinple tonc on  the speaker
                    !  Outpur  a telephone  |one signal  on the speaker


                    ADVANCED  PROGBAM
                    !  Move an WC sc  o baok and  lbfth



                    Programs  That  Read the  InPuts

                    and  Then  Provide  Output


                     l.  Write a simple  program  to  read the lirst  colunrn, Iirst  row bulton'  and tum ON one
                       LED while the button  is down.
                    2. Rcad  the enlirc  keyborrd and  display thc binaiy  value ofthe row and  column  read
                       on the  LCD.
                    3. Read the  kelboatd and  display decimal  key  number on the  LCD
                    4. Read one  potentiometer and display  its S_bil value  on thc LCD in binaty,  hex, and
                       decimal  notation. Also  display the binary  value on  the bargraph
                     5. Read all three  potentiometers and display  their values  on the  LCD-
                     6. Advancedr Use  the tfuee  potentiomcters to control an R/C scrvo Conrol  the loca
                       tion of the center  position,  the  limit position  of the end  positions,  and  the rale of move-
                       mcnl. Use  thrcc switches  on the  keyboard to move thc servo  clockwise'  center  the
                       servo,  and movc i! conDterclockwise.


                                     Outputs
                     Creating

                     k willbc easier  if wc learn  to conlrol the  outputs  first because  we can do this  wilh  pto_
                     grams  that we write without lhe need for any additional hardware  or input signal we
                     will stdrt with the  simple control  ofLEDS.  proceed  to the  control of the two line  LCD,
   53   54   55   56   57   58   59   60   61   62   63