MikroElektronika PIC Microcontrollers PIC16 Arkusz Danych Strona 160

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
Przeglądanie stron 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
Przeglądanie stron 159
1 2 ... 155 156 157 158 159 160 161 162 163 164 165 ... 193 194

Komentarze do niniejszej Instrukcji

Brak uwag