Телесистемы
 Разработка, производство и продажа радиоэлектронной аппаратуры
На главную   | Карта сайта | Пишите нам | В избранное
Требуется программист в Зеленограде
- обработка данных с датчиков; ColdFire; 40 тыс.
e-mail:jobsmp@pochta.ru

Телесистемы | Электроника | Конференция «Микроконтроллеры и их применение»

Держите

Отправлено 507 12 марта 2007 г. 10:10
В ответ на: LCD PG320240WRF - как заставить работать??? отправлено mao 12 марта 2007 г. 02:59

//=== SYSTEM SET settings ===
//-------- P1 -------------
#define M0 0 //{0,1} 0-Internal CGROM 1-External
#define M1 0 //{0,1} 0-No D6 correction 1-D6 correction
#define M2 0 //{0,1} 0-8 pixel char heigh 1-16
#define WS 0 //{0,1}
#define IV 1 //{0,1}
//-------- P2 -------------
#define WF 1 //{0,1}
#define FX 7 //{0,7}
//-------- P3 -------------
#define FY 15 //{0,15}
//-------- P4 -------------
#define CR 39 //{0,239}
//-------- P5 -------------
#define TCR 53 //{0,255}
//-------- P6 -------------
#define LF 239 //{0,255}
//------- P7,8 ------------
#define AP 40 //{0,65535}

//=== SCROLL settings ===
//------- P1,2 ------------
#define SAD1 0 //{0,65535}
//-------- P3 -------------
#define SL1 239 //{0,255}
//------- P4,5 ------------
#define SAD2 0x2580 //{0,65535}
//-------- P6 -------------
#define SL2 239 //{0,255}
//------- P7,8 ------------
#define SAD3 0 //{0,65535}
//------- P9,10 -----------
#define SAD4 0 //{0,65535}

//=== CSRFORM settings ===
//-------- P1 -------------
#define CRX 7 //{0,15} cursor X size
//-------- P2 -------------
#define CM 1 //{0,1} 0-underscore 1-block
#define CRY 15 //{0,15} cursor Y size

//=== CSRDIR settings ===
#define CD 0 //{0,3} 0-right 1-left 2-up 3-down

//=== OVLAY settings ===
//-------- P1 -------------
#define OV 0 //{0,1} 0- two-layer 1- three-layer composition in graphics mode
#define DM2 0 //{0,1} BLOCK2: 0-text 1-graphics
#define DM1 1 //{0,1} BLOCK1: 0-text 1-graphics
#define MX 0 //{0,3} 0-OR 1-Exclusive-OR 2-AND 3-Priority OR

//=== DISP ON/OFF settings ===
#define D 1 //{0,1} 0-display OFF 1-display ON
//-------- P1 -------------
#define FP1 1 //{0,3} 0-OFF 1-ON, No flashing 2-ON,2 Hz 3-ON,16 Hz
#define FP2 0 //{0,3} 0-OFF 1-ON, No flashing 2-ON,2 Hz 3-ON,16 Hz
#define FP3 0 //{0,3} 0-OFF 1-ON, No flashing 2-ON,2 Hz 3-ON,16 Hz
#define FC 0 //{0,3} 0-Cursor OFF, 1-ON, No flashing 2-ON,2 Hz 3-ON,16 Hz

//=== CGRAM ADR settings ===
//------- P1,2 ------------
#define SAGL 0xF000 //{0,65535}

void LCD_Init()
{
LCD_PORT_Init();

LCD_PORT_WriteCR(0x40); //SYSTEM SET command
LCD_PORT_WriteDR((IV<<5)|(1<<4)|(WS<<3)|(M2<<2)|(M1<<1)|(M0<<0));
LCD_PORT_WriteDR((WF<<7)|(FX<<0));
LCD_PORT_WriteDR(FY);
LCD_PORT_WriteDR(CR);
LCD_PORT_WriteDR(TCR);
LCD_PORT_WriteDR(LF);
LCD_PORT_WriteDR(AP%256);
LCD_PORT_WriteDR(AP/256);

LCD_PORT_WriteCR(0x44); //SCROLL command
LCD_PORT_WriteDR(SAD1%256);
LCD_PORT_WriteDR(SAD1/256);
LCD_PORT_WriteDR(SL1);
LCD_PORT_WriteDR(SAD2%256);
LCD_PORT_WriteDR(SAD2/256);
LCD_PORT_WriteDR(SL2);
LCD_PORT_WriteDR(SAD3%256);
LCD_PORT_WriteDR(SAD3/256);
LCD_PORT_WriteDR(SAD4%256);
LCD_PORT_WriteDR(SAD4/256);

LCD_PORT_WriteCR(0x5D); //CSRFORM command
LCD_PORT_WriteDR(CRX);
LCD_PORT_WriteDR((CM<<7)|(CRY<<0));

LCD_PORT_WriteCR(0x4C|CD); //CSRDIR command

LCD_PORT_WriteCR(0x5B); //OVLAY command
LCD_PORT_WriteDR((OV<<4)|(DM2<<3)|(DM1<<2)|(MX<<0));

LCD_PORT_WriteCR(0x59); //DISP ON/OFF
LCD_PORT_WriteDR((FP3<<6)|(FP2<<4)|(FP1<<2)|(FC<<0));

LCD_PORT_WriteCR(0x5C); //CGRAM ADR command
LCD_PORT_WriteDR(SAGL%256);
LCD_PORT_WriteDR(SAGL/256);

LCD_PORT_WriteCR(0x46); //CSRW
LCD_PORT_WriteDR(SAGL%256);
LCD_PORT_WriteDR(SAGL/256);
//WriteCR(0x42); for(i=0;i LCD_ClearScreen();

}


Составить ответ | Вернуться на конференцию

Ответы


Отправка ответа
Имя*: 
Пароль: 
E-mail: 
Тема*:

Сообщение:

Ссылка на URL: 
URL изображения: 

если вы незарегистрированный на форуме пользователь, то
для успешного добавления сообщения заполните поле, как указано ниже:
введите число 63:

Перейти к списку ответов | Конференция | Раздел "Электроника" | Главная страница | Карта сайта

Rambler's Top100 Рейтинг@Mail.ru
 
Web telesys.ru