MikroElektronika PIC Microcontrollers PIC16 Fiche technique Page 158

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 194
  • Table des matières
  • DEPANNAGE
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 157
Programming PIC Microcontrollers in BASIC - mikroElektronika
Potentiometer gives 0V in one terminal position and 5V in the other – since we use 8-bit conversion, our digitalized
voltage can have 256 steps. The following program reads voltage on RA0 pin and displays it on port B diodes. If not one
diode is on, result is zero and if all of diodes are on, result is 255.
program ADC_8
main:
TRISA = %111111 ' Port A is input
PORTD = 0
TRISD = %00000000
ADCON1 = %1000010 ' Port A is in analog mode,
' 0 and 5V are referent voltage values,
' and the result is aligned right
' (higher 6 bits of ADRESH are zero).
ADCON0 = %11010001 ' ADC clock is generated by internal RC
http://www.mikroelektronika.co.yu/english/product/books/picbasicbook/06.htm (4 sur 12)05/11/2004 02:26:24
Vue de la page 157
1 2 ... 153 154 155 156 157 158 159 160 161 162 163 ... 193 194

Commentaires sur ces manuels

Pas de commentaire