This is a sample program to drive a 128x128 LCD with t6963 controller through SPI by means of an MCP23S17 16-Bit I/O Expander with Serial Interface
Diff: MCP23S17.h
- Revision:
- 0:bf72877f77ab
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MCP23S17.h Sun Dec 05 14:31:49 2010 +0000 @@ -0,0 +1,54 @@ +/* MCP23S17 - drive the Microchip MCP23S17 16-bit Port Extender using SPI +* Copyright (c) 2010 Romilly Cocking +* Released under the MIT License: http://mbed.org/license/mit +* +* version 0.4 +*/ +#include "mbed.h" + + +#define INTERRUPT_POLARITY_BIT 0x02 +#define INTERRUPT_MIRROR_BIT 0x40 + +// all register addresses assume IOCON.BANK = 0 (POR default) + +#define IODIRA 0x00 +#define IODIRB 0x01 +#define IPOLA 0x02 +#define IPOLB 0x03 +#define GPINTENA 0x04 +#define GPINTENB 0x05 +#define DEFVALA 0x06 +#define DEFVALB 0x07 +#define INTCONA 0x08 +#define INTCONB 0x09 +#define IOCONA 0x0A +#define IOCONB 0x0B +#define GPPUA 0x0C +#define GPPUB 0x0D +#define INTFA 0x0E +#define INTFB 0x0F +#define INTCAPA 0x10 +#define INTCAPB 0x11 +#define GPIOA 0x12 +#define GPIOB 0x13 +#define OLATA 0x14 +#define OLATB 0x15 + +#define LCD_HALT 0x80 +#define LCD_FS 0x20 +#define LCD_RST 0x10 +#define LCD_CD 0x08 +#define LCD_CE 0x04 +#define LCD_RD 0x02 +#define LCD_WR 0x01 + +// T6963C OPCODES +#define TXHOME 0x40 // SET TXT HM ADD +#define TXAREA 0x41 // SET TXT AREA +#define GRHOME 0x42 // SET GRAPHIC HOME ADDRESS +#define GRAREA 0x43 // SET GRAPHIC AREA +#define OFFSET 0x22 // SET OFFSET ADDRESS +#define ADPSET 0x24 // SET ADDRESS POINTER +#define AWRON 0xB0 // SET AUTO WRITE MODE +#define AWROFF 0xB2 // RESET AUTO WRITE MODE