MikroElektronika PIC Microcontrollers PIC16 Dokumentacja Strona 139

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 186
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 138
Chapter 6 - Samples
Macro for LCD support
LCDinit macro used to initialize port connected to LCD. LCD is configured to work in four-bit
mode.
Example: LCDinit
LCDchar LCDarg Write ASCII character. Argument is ASCII caracter.
Example: LCDChar 'd'
LCDw Write character found in W register.
Example: movlw 'p'
LCDw
LCDcmd LCDcommand Sending command instructions
Example: LCDcmd LCDCH
LCD_DDAdr DDRamAddress Set DD RAM address.
Example: LCD_DDAdr .3
LCDline line_num Set cursor to the beginning of 1st or 2nd row
Example: LCDline 2
When working with a microcontroller the numbers are presented in a binary form.
As such, they cannot be displayed on a display. That's why it is necessary to change the numbers
from a binary system into a decimal system so they can be easily understood. Listings of two
macros LCDval_08 and LCDval_16 are given below.
Macro LCDval_08 converts an eight-bit binary number into a decimal number from 0 to 255 and
displays it on the LCD display. It is necessary to declare the following variables in the main
program: TEMP1, TEMP2, LO, LO_TEMP, Bcheck. An eight-bit binary number is found in variable
LO. When a macro was executed, the decimal equivalent of its number would be displayed on the
LCD display. The leading zeros before the number will not be displayed.
http://www.mikroelektronika.co.yu/english/product/books/PICbook/6_10Poglavlje.htm (7 of 11) [4/2/2003 16:19:08]
Przeglądanie stron 138
1 2 ... 134 135 136 137 138 139 140 141 142 143 144 ... 185 186

Komentarze do niniejszej Instrukcji

Brak uwag