1) 지식 창고는 본인이 작성한 콘텐츠(팁/노하우/리소스/강좌 등)을 무료 혹은 가상화폐인 납포인트를 통해 공유하는 공간입니다.
2) 본인이 작성한 콘텐츠에 대해서만 지식 창고에 등록할 수 있으며, 저작권에 위배되는 콘텐츠는 사전경고 없이 삭제될 수 있습니다.
3) 콘텐츠 구매 및 첨부파일 다운로드는 회원그룹 '연구원' 이상 가능하오니, 경험치를 쌓아 진급한 후에 이용 부탁드립니다.
4) 무료 콘텐츠의 본문은 구매절차 없이 즉시 이용할 수 있으며, 판매 납포인트가 있는 콘텐츠는 구매 후 이용할 수 있습니다.
5) 콘텐츠 판매에 따른 납포인트 수익은 지정한 비율(50%)에 따라 판매자에게 지급하며, 납포인트 수익을 통해 진급을 빨리할 수 있습니다.
6) 구매 후 평가를 하면 구매 납포인트의 20%를 돌려 드립니다.
판매자 | 심야땜쟁이 | 판매 납포인트 | 무료 | 평점 | 0점 / 총 0명 참여 |
---|
UC1617 Driver를 사용하는 LCD의 Source Code 입니다.
MCU는 ATmega128 사용했고, Compiler는 CodeVision AVR 2.04.4a 사용했습니다.
-------------------------------------------------------------------------------------------------------------------------------------
#define UC1617_COMMAND_SET_PAGE_C_ADDRESS 0X00 // 0 0 0 # # # # #
#define UC1617_COMMAND_SET_TEMP_COMPENSATION 0X24 // 0 0 1 0 0 1 # #
#define UC1617_COMMAND_SET_PANEL_LOADING 0X28 // 0 0 1 0 1 0 # #
#define UC1617_COMMAND_SET_PUMP_CONTROL 0X2C // 0 0 1 0 1 1 # #
#define UC1617_COMMAND_SET_ADV_PROGRAM CONTROL 0X30 // 0 0 1 1 0 0 # # # # # # # # # #
#define UC1617_COMMAND_SET_SCROLL_LINE_LSB 0X40 // 0 1 0 0 # # # #
#define UC1617_COMMAND_SET_SCROLL LINE_MSB 0X50 // 0 1 0 1 - # # #
#define UC1617_COMMAND_SET_ROW_ADDRESS_LSB 0X60 // 0 1 1 0 # # # #
#define UC1617_COMMAND_SET_ROW_ADDRESS_MSB 0X70 // 0 1 1 1 - # # #
#define UC1617_COMMAND_SET_VBIAS_POTENTIOMETER 0X81 // 1 0 0 0 0 0 0 1 # # # # # # # #
#define UC1617_COMMAND_SET_PARTIAL_DISPLAY CONTROL 0X84 // 1 0 0 0 0 1 # #
#define UC1617_COMMAND_SET_RAM_ADDRESS_CONTROL 0X88 // 1 0 0 0 1 # # #
#define UC1617_COMMAND_SET_FIXED_LINES 0X90 // 1 0 0 1 0 0 0 0 # # # # # # # #
#define UC1617_COMMAND_SET_LINE_RATE 0XA0 // 1 0 1 0 0 0 # #
#define UC1617_COMMAND_SET_ALL_PIXEL_ON 0XA4 // 1 0 1 0 0 1 0 #
#define UC1617_COMMAND_SET_INVERSE_DISPLAY 0XA6 // 1 0 1 0 0 1 1 #
#define UC1617_COMMAND_SET_DISPLAY_ENABLE 0XAC // 1 0 1 0 1 1 # #
#define UC1617_COMMAND_SET_LCD_MAPPING_CONTROL 0XC0 // 1 1 0 0 0 # # #
#define UC1617_COMMAND_SET_N_LINE_INVERSION 0XC8 // 1 1 0 0 1 0 0 0 # # # # # # # #
#define UC1617_COMMAND_SET_LCD_GRAY_SHADE 0xD0 // 1 1 0 1 0 # # #
#define UC1617_COMMAND_SYSTEM_RESET 0xE2 // 1 1 1 0 0 0 1 0
#define UC1617_COMMAND_NOP 0xE3 // 1 1 1 0 0 0 1 1
#define UC1617_COMMAND_SET_LCD_BIAS_RATIO 0xE8 // 1 1 1 0 1 0 # #
//#define LCD_BIAS_
#define UC1617_COMMAND_RESET_CURSOR_UPDATE_MODE 0xEE // 1 1 1 0 1 1 1 0
#define UC1617_COMMAND_SET_CURSOR_UPDATE_MODE 0xEF // 1 1 1 0 1 1 1 1
#define UC1617_COMMAND_SET_COM_END 0xF1 // 1 1 1 1 0 0 0 1 # # # # # # # #
#define UC1617_COMMAND_SET_PARTIAL_DISPLAY_START 0xF2 // 1 1 1 1 0 0 1 0 # # # # # # # #
#define UC1617_COMMAND_SET_PARTIAL_DISPLAY_END 0xF3 // 1 1 1 1 0 0 1 1 # # # # # # # #
#define UC1617_COMMAND_SET_WIN_START_PAGE_C_ADDRESS 0xF4 // 1 1 1 1 0 1 0 0 # # # # # # # #
#define UC1617_COMMAND_SET_WIN_START_ROW_ADDRESS 0xF5 // 1 1 1 1 0 1 0 1 # # # # # # # #
#define UC1617_COMMAND_SET_WIN_END_PAGE_C_ADDRESS 0xF6 // 1 1 1 1 0 1 1 0 # # # # # # # #
#define UC1617_COMMAND_SET_WIN_END_ROW_ADDRESS 0xF7 // 1 1 1 1 0 1 1 1 # # # # # # # #
#define UC1617_COMMAND_ENABLE_WINDOW_PROGRAM 0xF8 // 1 1 1 1 1 0 0 0 # # # # # # # #
#define UC1617_COMMAND_SET_MTP_OPERATION_CONTROL 0xB8 // 1 0 1 1 1 0 0 0 # # # # # # # #
#define UC1617_COMMAND_SET_MTP_WRITE_MASK 0xB9 // 1 0 1 1 1 0 0 1 # # # # # # # #
#define UC1617_COMMAND_SET_VMTP1_POTENTIOMETER 0xF4 // 1 1 1 1 0 1 0 0 # # # # # # # #
#define UC1617_COMMAND_SET_VMTP2_POTENTIOMETER 0xF5 // 1 1 1 1 0 1 0 1 # # # # # # # #
#define UC1617_COMMAND_SET_MTP_WRITE_TIMER 0xF6 // 1 1 1 1 0 1 1 0 # # # # # # # #
#define UC1617_COMMAND_SET_MTP_READ_TIMER 0xF7 // 1 1 1 1 0 1 1 1 # # # # # # # #
void UC1617_WriteCommand ( byte Command )
{
UC1617_CD = 0;
UC1617_CS0 = 0;
UC1617_WRITE_DATA = Command;
#asm ("nop");
#asm ("nop");
#asm ("nop");
UC1617_WR = 0;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
UC1617_WR = 1;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
UC1617_CS0 = 1;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
}
void UC1617_WriteData ( byte Data )
{
UC1617_CD = 1;
UC1617_CS0 = 0;
UC1617_WRITE_DATA = Data;
#asm ("nop");
#asm ("nop");
#asm ("nop");
UC1617_WR = 0;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
UC1617_WR = 1;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
UC1617_CS0 = 1;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
}
byte UC1617_ReadData ( void )
{ byte Data;
UC1617_WRITE_DATA = 0xFF;
UC1617_DIR_DATA = 0x00;
#asm ("nop");
UC1617_CD = 1;
UC1617_CS0 = 0;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
UC1617_RD = 0;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
Data = UC1617_READ_DATA;
UC1617_RD = 1;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
UC1617_CS0 = 1;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
UC1617_DIR_DATA = 0xFF;
#asm ("nop");
return Data;
}
TypeUnionDword Status;
dword UC1617_ReadStatus ( void )
{ byte Data;
Status.Byte[3] = 0x00;
Status.Byte[2] = 0x00;
Status.Byte[1] = 0x00;
Status.Byte[0] = 0x00;
UC1617_DIR_DATA = 0x00;
#asm ("nop");
UC1617_CD = 0;
UC1617_CS0 = 0;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
UC1617_RD = 0;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
Data = UC1617_READ_DATA;
Status.Byte[2] = Data;
UC1617_RD = 1;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
UC1617_CS0 = 1;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
UC1617_CD = 0;
UC1617_CS0 = 0;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
UC1617_RD = 0;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
Data = UC1617_READ_DATA;
Status.Byte[1] = Data;
UC1617_RD = 1;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
UC1617_CS0 = 1;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
UC1617_CD = 0;
UC1617_CS0 = 0;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
UC1617_RD = 0;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
Data = UC1617_READ_DATA;
Status.Byte[0] = Data;
UC1617_RD = 1;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
UC1617_CS0 = 1;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
UC1617_DIR_DATA = 0xFF;
#asm ("nop");
return Status.Dword;
}
byte UC1617_SetXY ( byte StartX, byte StartY )
{ byte RowAddress;
byte LowerAddress;
byte UpperAddress;
byte PageAddress;
byte OffsetCount;
RowAddress = StartY;
LowerAddress = ( 0x60 | ( RowAddress & 0x0F ));
UpperAddress = ( 0x70 | (( RowAddress >> 0x04 ) & 0x07 ));
PageAddress = ( StartX >> 0x03 );
OffsetCount = ( StartX & 0x07 );
UC1617_WriteCommand ( LowerAddress );
UC1617_WriteCommand ( UpperAddress );
UC1617_WriteCommand ( PageAddress );
return OffsetCount;
}
#define FONT_SMALL 0
#define FONT_MIDDLE 1
#define FONT_LARGE 2
void UC1617_Initialize ( void )
{
/*
//UC1617_WriteCommand (0xE2); // SET SYSTEM RESET
//delay_ms (1000);
UC1617_WriteCommand ( UC1617_COMMAND_SET_LCD_BIAS_RATIO + 0x03 );
UC1617_WriteCommand ( UC1617_COMMAND_SET_VBIAS_POTENTIOMETER );
UC1617_WriteCommand ( 55 ); // 55
UC1617_WriteCommand ( UC1617_COMMAND_SET_TEMP_COMPENSATION + 0x03 ); // SET TEMP=-0.1%
UC1617_WriteCommand ( UC1617_COMMAND_SET_LCD_GRAY_SHADE + 0x00 ); // SET GRAY SHADE
UC1617_WriteCommand ( UC1617_COMMAND_SET_PANEL_LOADING + 0x01 ); // < 7.2NF
UC1617_WriteCommand ( UC1617_COMMAND_SET_PUMP_CONTROL + 0x03 ); // INTERNAL PUMP
UC1617_WriteCommand ( UC1617_COMMAND_SET_RAM_ADDRESS_CONTROL + 0x01 ); // SET RAM CONTROL
// AC[2] = 0 AC[1] = 0 AC[0] = 1
// AC[2] RID : When AC0 = 1 and CA reaches CA boundary, PID controls whether row Address will be adjusted by +1 or -1.
// AC[1] AI : 0 : COLUMN ADDRESS increase (+1) first until CA reaches CA boundary, then RA will increase by (+/-1).
// 1 : ROW ADDRESS increase (+/-1) first until RA reach RA boundary, then CA will increase by (+1).
// AC[0] WA : 0: CA or RA ( depends on AC[1]= 0 or 1 ) will stop increasing after reaching boundary.
// 1: CA or RA ( depends on AC[1]= 0 or 1 ) will restart, and RA or CA will increase by one.
UC1617_WriteCommand ( UC1617_COMMAND_SET_LINE_RATE + 0x00 ); // SET LINE RATE
// 00b : 14.2 Kl/s
// 01b : 17.3 Kl/s
// 10b : 21.1 Kl/s
// 11b : 25.6 Kl/s
UC1617_WriteCommand ( UC1617_COMMAND_SET_LCD_MAPPING_CONTROL + 0x04 ); // SET LCD MAP CONTROL
// MY : MY is implemented by reversing the mapping order between RAM and COM electrodes.
// The data stored in RAM is not affected by MY command. MY will have immediate effect on the display image.
// MX : MX is implemented by selecting the CA or 31-CA as write/read (from host interface) display RAM
// page_c address so this function will only take effect after rewriting the RAM data.
// LC0 : LC0 controls whether the soft icon section (0~ 2xFL) is display or not during partial display mode.
UC1617_WriteCommand ( UC1617_COMMAND_SET_COM_END ); // CON
UC1617_WriteCommand ( 127 );
UC1617_WriteCommand ( UC1617_COMMAND_SET_DISPLAY_ENABLE + 0x03 ); // SET DISPLAY ENABLE/4-GRAY
delay_ms (100);
*/
UC1617_WriteCommand ( 0xe2); // SET SYSTEM RESET
delay_ms (1000);
//UC1617_WriteCommand ( 0xea); // SET BIAS=1/11
UC1617_WriteCommand ( 0x25); // SET TEMP=-0.1%
UC1617_WriteCommand ( 0xd0); // SET GRAY SHADE
UC1617_WriteCommand ( 0x28); // <7.2NF
UC1617_WriteCommand ( 0x2f); // INTERNAL PUMP
UC1617_WriteCommand ( 0x81); // SET VOP
UC1617_WriteCommand ( 55); // 55
UC1617_WriteCommand ( 0x89); // SET RAM CONTROL
UC1617_WriteCommand ( 0xa3); // SET LINE RATE
UC1617_WriteCommand ( 0xc2); // SET LCD MAP CONTROL
UC1617_WriteCommand ( 0xf1); // CON
UC1617_WriteCommand ( 127);
UC1617_WriteCommand ( 0xAf); // SET DISPLAY ENABLE/4-GRAY
delay_ms (100);
}