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

Dependencies:   mbed

mcp_lcd.h

Committer:
gertk
Date:
2010-12-05
Revision:
1:e98e29ea2d03
Child:
2:9071445a6895

File content as of revision 1:e98e29ea2d03:

/* MCP23S17 - Microchip MCP23S17 16-bit Port Extender using SPI
* Copyright (c) 2010 Gert van der Knokke
*/
#include "mbed.h"

#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

// LCD pin connections/bit numbers
#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