![](/media/cache/profiles/94aef38441efa3380a3bed3faf1f9d5d.50x50_q85.jpg)
This program is ZY-FGD1442701V1's demo code.
Diff: main.cpp
- Revision:
- 0:2ca8c28cb72c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Wed Jun 30 16:11:31 2010 +0000 @@ -0,0 +1,180 @@ +#include "mbed.h" + +DigitalOut CS(p21); +DigitalOut A0(p22); +DigitalOut E(p23); +DigitalOut WRB(p24); +DigitalOut RES(p25); + +BusOut P1(p10, p11, p12, p13, p14, p15, p16, p17); + +void WriteCOM(unsigned char a) { + CS=0; + E=1; + A0=0; + P1=a; + WRB=0; + WRB=1; + CS=1; +} + +void WriteDAT(unsigned char b) { + CS=0; + E=1; + A0=1; + P1=b; + WRB=0; + WRB=1; + CS=1; +} + + +int main() { + int i,j; + + RES=1; + wait_ms(100); + RES=0; + wait_ms(100); + RES=1; + wait_ms(120); + + WriteCOM(0x01); + wait_ms(50); + + WriteCOM(0x11);//SLEEP OUT + wait_ms(200); + + WriteCOM(0xFF); + WriteDAT(0x40); + WriteDAT(0x03); + WriteDAT(0x1A); + + WriteCOM(0xd9); + WriteDAT(0x60); + WriteCOM(0xc7); + WriteDAT(0x90); + wait_ms(200); + + WriteCOM(0xB1); + WriteDAT(0x04); + WriteDAT(0x25); + WriteDAT(0x18); + + WriteCOM(0xB2); + WriteDAT(0x04); + WriteDAT(0x25); + WriteDAT(0x18); + + WriteCOM(0xB3); + WriteDAT(0x04); + WriteDAT(0x25); + WriteDAT(0x18); + WriteDAT(0x04); + WriteDAT(0x25); + WriteDAT(0x18); + + WriteCOM(0xB4); + WriteDAT(0x03); + + WriteCOM(0xB6); + WriteDAT(0x15); + WriteDAT(0x02); + + WriteCOM(0xC0);// POWER CONTROL 1 GVDD&VCI1 + WriteDAT(0x02); + WriteDAT(0x70); + + WriteCOM(0xC1);// POWER CONTROL 2 GVDD&VCI1 + WriteDAT(0x07); + + WriteCOM(0xC2);// POWER CONTROL 3 GVDD&VCI1 + WriteDAT(0x01); + WriteDAT(0x01); + + WriteCOM(0xC3);// POWER CONTROL 4 GVDD&VCI1 + WriteDAT(0x02); + WriteDAT(0x07); + + WriteCOM(0xC4);// POWER CONTROL 5 GVDD&VCI1 + WriteDAT(0x02); + WriteDAT(0x04); + + WriteCOM(0xFC);// POWER CONTROL 6 GVDD&VCI1 + WriteDAT(0x11); + WriteDAT(0x17); + + WriteCOM(0xC5);//VCOMH&VCOML + WriteDAT(0x3c); + WriteDAT(0x4f); + + WriteCOM(0x36);//MV,MX,MY,RGB + WriteDAT(0xC8); + + + WriteCOM(0x3a);//GAMMA SET BY REGISTER + WriteDAT(0x05); + +//***********************GAMMA************************* + WriteCOM(0xE0); + WriteDAT(0x06); + WriteDAT(0x0E); + WriteDAT(0x05); + WriteDAT(0x20); + WriteDAT(0x27); + WriteDAT(0x23); + WriteDAT(0x1C); + WriteDAT(0x21); + WriteDAT(0x20); + WriteDAT(0x1C); + WriteDAT(0x26); + WriteDAT(0x2F); + WriteDAT(0x00); + WriteDAT(0x03); + WriteDAT(0x00); + WriteDAT(0x24); + + WriteCOM(0xE1); + WriteDAT(0x06); + WriteDAT(0x10); + WriteDAT(0x05); + WriteDAT(0x21); + WriteDAT(0x27); + WriteDAT(0x22); + WriteDAT(0x1C); + WriteDAT(0x21); + WriteDAT(0x1F); + WriteDAT(0x1D); + WriteDAT(0x27); + WriteDAT(0x2F); + WriteDAT(0x05); + WriteDAT(0x03); + WriteDAT(0x00); + WriteDAT(0x3F); + +//***************************RAM ADDRESS******************* + WriteCOM(0x2A); + WriteDAT(0x00); + WriteDAT(0x02); + WriteDAT(0x00); + WriteDAT(0x81); + + WriteCOM(0x2B); + WriteDAT(0x00); + WriteDAT(0x03); + WriteDAT(0x00); + WriteDAT(0x82); + + WriteCOM(0x29); + wait_ms(100); + + WriteCOM(0x2C); + + + for (i=0;i<128;i++) { + for (j=0;j<128;j++) { + WriteDAT(0xf8); + WriteDAT(0x00); //display red + } + } +}