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

s[f,PLE SW|ICHES At{D OTHER COI|T CTS   i67



                  be at 12 volts- Most automotive volrages  are currently at 12  volts  (the  measured volt-
                  age oD a charged battery  on a running car will be  slightly higher). Heavy dury trucks
                  o{1en use twice this voltage.Ifyou  are considering  elcctronic devices, the voltages will
                  probably  be belween 3 and 9 volts.  Conditioning dc signals for inrroduction  into a
                                is
                  microprocessor usually a matter  of making sure not too much cunent  or too high a
                  voltage  goes  into the electronics with appropriare resisrarces and  buffcrs.
                                       "JOB
                  Note  SdJ&ry isdlnd)l      1." Be cautioned Lhat ||he  wo*ing around lead acid
                  batteries, extremely larye currents (well oyet 50A amps instuntuneousb) are easilJ
                  areilable dt the baxery temtinals.These  high cuffents ca  be tlengerous dnllirill  easily
                  melt wires and  eren wrcnches . Be wr)" careful when  w)rkin]  dround lead ddd battefies  .
                  Ifyou  are not  faniliar  with hazanls associated  with bdtteries  (acids  and hJdrogen),  ),ou
                  shouA t1:1ke the time to become acquaintedwith  this aspect of  your h,otkforyow o',\,n s.letJ,
                  and the saJetr oJ those around  )ou,  beJorc  Jou  start.
                    A1l the signals we collect  must be condirioned and converted  to a fbrm thar the
                  micrcprocessor can safely accept.  The conversion into digilal format  can rake  place  in
                  the microprocessor itself,  so  we do not have to worry about  any extemal electronics
                  to do that.
                    We have two interests  in the incoming  signal. Wilh dc signals, we want ro know if
                  the signal is on or ol-f, and we want to know  its magnitude-  (dc  signals  can also cone
                  in as a  square wave or a frequency, which  is covered under ac.)
                    On off inlbrmation is used as  a means ofderecting whar rhc  conditiots downstream
                  liom us are so we can send  control infbrmation to what i  s upsfeam fiom us. If a device
                  that is interacting with us has come on, we need to respond  to it in a specific manner,
                  meaning that the information  should be used as  pan  ofour control functions.
                    Magnitude information is used to determjne  the condition of the signal we are moni
                  toring, to know if we are  getting  the reslrlts we  want. If we dre rying  to maintain  the tem
                  perature  of an oven, we need to know the nagnitude of the signal coming  10 us across the
                  thermocouple so we can conveil it into a temperature and then  compare thai temperature
                  to what was needed, in order to decide wherher to turn the heating elements either on or
                  off. The insoument we  design manipulates the thermocouple voltage  data, to comprehend
                  the information in thc sisnal. and then makes the dccision  that conrrols rhe heaters.


                  Smple         Switches                Other      Contacts
                                                 and

                  KEYBOARDS
                  The reading  of keyboards  and other matrices  of switches is covered in grear  derail in
                  the earlier  part  oflhc tutorial underkeyboards.

                  BELAYS

                  A relay can  casily be used to provide  a dry contacr that can be read wjtb thc PlC.
                  These  contacts are  quiae  noisy (electrically)  and should be debounced  either with
   168   169   170   171   172   173   174   175   176   177   178