![](/media/cache/profiles/f93486bfff38ca69d76d85c089569a09.50x50_q85.jpg)
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
mcp_lcd.h@1:e98e29ea2d03, 2010-12-05 (annotated)
- Committer:
- gertk
- Date:
- Sun Dec 05 14:38:10 2010 +0000
- Revision:
- 1:e98e29ea2d03
- Child:
- 2:9071445a6895
0.0002
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gertk | 1:e98e29ea2d03 | 1 | /* MCP23S17 - Microchip MCP23S17 16-bit Port Extender using SPI |
gertk | 1:e98e29ea2d03 | 2 | * Copyright (c) 2010 Gert van der Knokke |
gertk | 1:e98e29ea2d03 | 3 | */ |
gertk | 1:e98e29ea2d03 | 4 | #include "mbed.h" |
gertk | 1:e98e29ea2d03 | 5 | |
gertk | 1:e98e29ea2d03 | 6 | #define IODIRA 0x00 |
gertk | 1:e98e29ea2d03 | 7 | #define IODIRB 0x01 |
gertk | 1:e98e29ea2d03 | 8 | #define IPOLA 0x02 |
gertk | 1:e98e29ea2d03 | 9 | #define IPOLB 0x03 |
gertk | 1:e98e29ea2d03 | 10 | #define GPINTENA 0x04 |
gertk | 1:e98e29ea2d03 | 11 | #define GPINTENB 0x05 |
gertk | 1:e98e29ea2d03 | 12 | #define DEFVALA 0x06 |
gertk | 1:e98e29ea2d03 | 13 | #define DEFVALB 0x07 |
gertk | 1:e98e29ea2d03 | 14 | #define INTCONA 0x08 |
gertk | 1:e98e29ea2d03 | 15 | #define INTCONB 0x09 |
gertk | 1:e98e29ea2d03 | 16 | #define IOCONA 0x0A |
gertk | 1:e98e29ea2d03 | 17 | #define IOCONB 0x0B |
gertk | 1:e98e29ea2d03 | 18 | #define GPPUA 0x0C |
gertk | 1:e98e29ea2d03 | 19 | #define GPPUB 0x0D |
gertk | 1:e98e29ea2d03 | 20 | #define INTFA 0x0E |
gertk | 1:e98e29ea2d03 | 21 | #define INTFB 0x0F |
gertk | 1:e98e29ea2d03 | 22 | #define INTCAPA 0x10 |
gertk | 1:e98e29ea2d03 | 23 | #define INTCAPB 0x11 |
gertk | 1:e98e29ea2d03 | 24 | #define GPIOA 0x12 |
gertk | 1:e98e29ea2d03 | 25 | #define GPIOB 0x13 |
gertk | 1:e98e29ea2d03 | 26 | #define OLATA 0x14 |
gertk | 1:e98e29ea2d03 | 27 | #define OLATB 0x15 |
gertk | 1:e98e29ea2d03 | 28 | |
gertk | 1:e98e29ea2d03 | 29 | // LCD pin connections/bit numbers |
gertk | 1:e98e29ea2d03 | 30 | #define LCD_HALT 0x80 |
gertk | 1:e98e29ea2d03 | 31 | #define LCD_FS 0x20 |
gertk | 1:e98e29ea2d03 | 32 | #define LCD_RST 0x10 |
gertk | 1:e98e29ea2d03 | 33 | #define LCD_CD 0x08 |
gertk | 1:e98e29ea2d03 | 34 | #define LCD_CE 0x04 |
gertk | 1:e98e29ea2d03 | 35 | #define LCD_RD 0x02 |
gertk | 1:e98e29ea2d03 | 36 | #define LCD_WR 0x01 |
gertk | 1:e98e29ea2d03 | 37 | |
gertk | 1:e98e29ea2d03 | 38 | // T6963C OPCODES |
gertk | 1:e98e29ea2d03 | 39 | #define TXHOME 0x40 // SET TXT HM ADD |
gertk | 1:e98e29ea2d03 | 40 | #define TXAREA 0x41 // SET TXT AREA |
gertk | 1:e98e29ea2d03 | 41 | #define GRHOME 0x42 // SET GRAPHIC HOME ADDRESS |
gertk | 1:e98e29ea2d03 | 42 | #define GRAREA 0x43 // SET GRAPHIC AREA |
gertk | 1:e98e29ea2d03 | 43 | #define OFFSET 0x22 // SET OFFSET ADDRESS |
gertk | 1:e98e29ea2d03 | 44 | #define ADPSET 0x24 // SET ADDRESS POINTER |
gertk | 1:e98e29ea2d03 | 45 | #define AWRON 0xB0 // SET AUTO WRITE MODE |
gertk | 1:e98e29ea2d03 | 46 | #define AWROFF 0xB2 // RESET AUTO WRITE MODE |