AVR Libc Home Page AVRs AVR Libc Development Pages
Main Page User Manual Reference FAQ Example Projects

hd44780.h

011/*
022* ----------------------------------------------------------------------------
033* "THE BEER-WARE LICENSE" (Revision 42): 044* <joerg@FreeBSD.ORG> wrote this file. As long as you retain this notice you 055* can do whatever you want with this stuff. If we meet some day, and you think 066* this stuff is worth it, you can buy me a beer in return. Joerg Wunsch 077* ---------------------------------------------------------------------------- 088* 099* HD44780 LCD display driver 1010* 1111* $Id: hd44780.h 2002 2009-06-25 20:21:16Z joerg_wunsch $ 1212*/ 1313 1414/* 1515* Send byte b to the LCD. rs is the RS signal (register select), 0 1616* selects instruction register, 1 selects the data register. 1717*/ 1818void hd44780_outbyte(uint8_t b, uint8_t rs); 1919 2020/* 2121* Read one byte from the LCD controller. rs is the RS signal, 0 2222* selects busy flag (bit 7) and address counter, 1 selects the data 2323* register. 2424*/ 2525uint8_t hd44780_inbyte(uint8_t rs); 2626 2727/* 2828* Wait for the busy flag to clear. 2929*/ 3030void hd44780_wait_ready(bool islong); 3131 3232/* 3333* Initialize the LCD controller hardware. 3434*/ 3535void hd44780_init(void); 3636 3737/* 3838* Prepare the LCD controller pins for powerdown. 3939*/ 4040void hd44780_powerdown(void); 4141 4242 4343/* Send a command to the LCD controller. */ 4444#define hd44780_outcmd(n) hd44780_outbyte((n), 0) 4545 4646/* Send a data byte to the LCD controller. */ 4747#define hd44780_outdata(n) hd44780_outbyte((n), 1) 4848 4949/* Read the address counter and busy flag from the LCD. */ 5050#define hd44780_incmd() hd44780_inbyte(0) 5151 5252/* Read the current data byte from the LCD. */ 5353#define hd44780_indata() hd44780_inbyte(1) 5454 5555 5656/* Clear LCD display command. */ 5757#define HD44780_CLR \ 58580x01 5959 6060/* Home cursor command. */ 6161#define HD44780_HOME \ 62620x02 6363 6464/* 6565* Select the entry mode. inc determines whether the address counter 6666* auto-increments, shift selects an automatic display shift. 6767*/ 6868#define HD44780_ENTMODE(inc, shift) \ 6969(0x04 | ((inc)? 0x02: 0) | ((shift)? 1: 0)) 7070 7171/* 7272* Selects disp[lay] on/off, cursor on/off, cursor blink[ing] 7373* on/off. 7474*/ 7575#define HD44780_DISPCTL(disp, cursor, blink) \ 7676(0x08 | ((disp)? 0x04: 0) | ((cursor)? 0x02: 0) | ((blink)? 1: 0)) 7777 7878/* 7979* With shift = 1, shift display right or left. 8080* With shift = 0, move cursor right or left. 8181*/ 8282#define HD44780_SHIFT(shift, right) \ 8383(0x10 | ((shift)? 0x08: 0) | ((right)? 0x04: 0)) 8484 8585/* 8686* Function set. if8bit selects an 8-bit data path, twoline arranges 8787* for a two-line display, font5x10 selects the 5x10 dot font (5x8 8888* dots if clear). 8989*/ 9090#define HD44780_FNSET(if8bit, twoline, font5x10) \ 9191(0x20 | ((if8bit)? 0x10: 0) | ((twoline)? 0x08: 0) | \ 9292((font5x10)? 0x04: 0)) 9393 9494/* 9595* Set the next character generator address to addr. 9696*/ 9797#define HD44780_CGADDR(addr) \ 9898(0x40 | ((addr) & 0x3f)) 9999 100100/* 101101* Set the next display address to addr. 102102*/ 103103#define HD44780_DDADDR(addr) \ 104104(0x80 | ((addr) & 0x7f)) 105105

uint8_t unsigned char uint8_t

Definition: stdint.h:83