MikroElektronika PIC Microcontrollers PIC16 Ficha de datos Pagina 158

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 194
  • Tabla de contenidos
  • SOLUCIÓN DE PROBLEMAS
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 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
Vista de pagina 157
1 2 ... 153 154 155 156 157 158 159 160 161 162 163 ... 193 194

Comentarios a estos manuales

Sin comentarios