MikroElektronika PIC Microcontrollers PIC16 Datový list Strana 160

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 194
  • Tabulka s obsahem
  • ŘEŠENÍ PROBLÉMŮ
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 159
Programming PIC Microcontrollers in BASIC - mikroElektronika
' in variable AD_Res.
PORTD = Lo(AD_Res) ' Display lower byte of result on PORTD
Delay_ms(500) ' 500 ms pause
goto eloop ' Repeat all
end. ' End of program
As one port is insufficient, we can use LCD for displaying all 10 bits of result. Connection scheme is below and the
appropriate program follows. For more information on LCD routines, check Chapter 5.2: Library Routines.
program ADC_on_LCD
dim AD_Res as word
dim dummyCh as char[6]
main:
TRISA = %1111111 ' PORTA is input
TRISB = 0 ' PORTB is output (for LCD)
ADCON1 = %10000010 ' PORTA is in analog mode,
' 0 and 5V are referent voltage values,
http://www.mikroelektronika.co.yu/english/product/books/picbasicbook/06.htm (6 sur 12)05/11/2004 02:26:25
Zobrazit stránku 159
1 2 ... 155 156 157 158 159 160 161 162 163 164 165 ... 193 194

Komentáře k této Příručce

Žádné komentáře