Kompatibilní zapojení: LCD panel s ATmega8
Ke stažení: lcd.c == lcd.pdf == lcd.htm
/*---------------------------------------------------------------------------
soubor: lcd.c
verze: 1.0
datum: 13.1.2012
popis:
Obsluzne rutiny pro displej 2x16 znaku s radicem HD44780
-Komunikace je ctyrbitova (pouzivaji se pouze piny displeje D4 - D7)
-Displej je v rezimu "pouze zapis" (signal "R/W" displeje je uzemen)
-Displej je pripojen k mikrokontroleru pouze signaly: RS, EN a D4 az D7.
Tento soubor vynikl upravou souboru "mojelib.h" jehoz autora bohuzel neznam.
---------------------------------------------------------------------------*/
#include <avr/pgmspace.h> // pgm_read_byte()
#ifndef setb //setb = makro ze souboru "wait.c"
#include "wait.c"
#endif
//Defaultni definice pinu, ke kterym je displej pripojen
#ifndef PORT_RS
#define PORT_RS PORTD
#define DDR_RS DDRD
#endif
#ifndef PORT_EN
#define PORT_EN PORTD
#define DDR_EN DDRD
#endif
#ifndef PORT_D4
#define PORT_D4 PORTD
#define PORT_D5 PORTD
#define PORT_D6 PORTD
#define PORT_D7 PORTD
#define DDR_D4 DDRD
#define DDR_D5 DDRD
#define DDR_D6 DDRD
#define DDR_D7 DDRD
#endif
#ifndef RS
#define RS 2
#endif
#ifndef EN
#define EN 3
#endif
#ifndef D4
#define D4 4
#define D5 5
#define D6 6
#define D7 7
#endif
// Funkce pro displej:
void lcd_ini (void); //inicializace
void lcd_instr(unsigned char ins); //napis instrukci
void lcd_char (unsigned char dat); //napis znak
void lcd_num3 (unsigned int num,unsigned char znak); //napis cislo (3 cifry)
void lcd_num2 (unsigned char num,unsigned char znak);//napis cislo (2 cifry)