Diff: I2CTextLCD.h
- Revision:
- 3:704f87be7993
- Parent:
- 2:1c5dea5d8783
diff -r 1c5dea5d8783 -r 704f87be7993 I2CTextLCD.h --- a/I2CTextLCD.h Thu Dec 23 12:42:37 2010 +0000 +++ b/I2CTextLCD.h Sun Apr 17 17:26:10 2011 +0000 @@ -10,10 +10,49 @@ #include "mbed.h" #include "Stream.h" -#define E_ON 0x10 //P4 -#define BACKLIGHT_ON 0x20 //P5 -#define RS_ON 0x80 //P7 +#define RS_ON 0x10 //P4 +#define E1_ON 0x20 //P5 +#define E2_ON 0x40 //P6 +#define BACKLIGHT_ON 0x80 //P7 + +/* Display ON/OFF Control defines */ +#define DON 0x0F //0b00001111 Display on +#define DOFF 0x0B //0b00001011 Display off +#define CURSOR_ON 0x0F //0b00001111 Cursor on +#define CURSOR_OFF OxOD //0b00001101 Cursor off +#define BLINK_ON 0x0F //0b00001111 Cursor Blink +#define BLINK_OFF 0x0E //0b00001110 Cursor No Blink + +/* Cursor or Display Shift defines */ +#define SHIFT_CUR_LEFT Ox13 //0b00010011 Cursor shifts to the left +#define SHIFT_CUR_RIGHT Ox17 //0b00010111 Cursor shifts to the right +#define SHIFT_DISP_LEFT Ox1B //0b00011011 Display shifts to the left +#define SHIFT_DISP_RIGHT 0x1F //0b00011111 Display shifts to the right +/* Function Set defines */ +#define EIGHT_BITMODE 0x03 //0b00000011 8-bit Interface D4-D7 +#define FOUR_BITMODE 0x02 //0b00000010 4-bit Interface D4-D7 +#define LINE_5X7 0x30 //0b00110000 +#define LINE_5X10 0x34 //0b00110100 +#define LINES_5X7 0x38 //0b00111000 + +// Addtional define to support display mode + +#define DISP_FLIP_NONE 0x00 //0b00111100 No flip +#define CLEAR_LCD 0x01 //0b00000001 + +// Addtional define to support entry mode & shift mode +//#define ENTRY_CURSOR_DEC 0b00000101 /* Entry cursor move left */ +//#define ENTRY_CURSOR_INC 0b00000111 /* Entry cursor move to right */ +//#define ENTRY_DISPLAY_SHIFT 0b00000111 /* Entry the display to shift */ +//#define ENTRY_DISPLAY_NO_SHIFT 0b00000110 /* Entry no shift */ + +// Use generic address + +#define LINE0 0x80 +#define LINE1 0xC0 +#define LINE2 0x94 +#define LINE3 0xD4 namespace mbed { /* Class: I2CTextLCD @@ -50,10 +89,10 @@ * P1 - D5 * P2 - D6 * P3 - D7 - * P4 - E - * P5 - backlight (connected to a relay) - * P6 - nc - * P7 - RS + * P4 - RS + * P5 - E1 + * P6 - E2 + * P7 - backlight (connected to a relay) * gnd - R/W * */