1) 지식 창고는 본인이 작성한 콘텐츠(팁/노하우/리소스/강좌 등)을 무료 혹은 가상화폐인 납포인트를 통해 공유하는 공간입니다.
2) 본인이 작성한 콘텐츠에 대해서만 지식 창고에 등록할 수 있으며, 저작권에 위배되는 콘텐츠는 사전경고 없이 삭제될 수 있습니다.
3) 콘텐츠 구매 및 첨부파일 다운로드는 회원그룹 '연구원' 이상 가능하오니, 경험치를 쌓아 진급한 후에 이용 부탁드립니다.
4) 무료 콘텐츠의 본문은 구매절차 없이 즉시 이용할 수 있으며, 판매 납포인트가 있는 콘텐츠는 구매 후 이용할 수 있습니다.
5) 콘텐츠 판매에 따른 납포인트 수익은 지정한 비율(50%)에 따라 판매자에게 지급하며, 납포인트 수익을 통해 진급을 빨리할 수 있습니다.
6) 구매 후 평가를 하면 구매 납포인트의 20%를 돌려 드립니다.
판매자 | 심야땜쟁이 | 판매 납포인트 | 무료 | 평점 | 0점 / 총 0명 참여 |
---|
LG2401281 ( Driver - T6963C ) LCD Source Code 입니다.
ATmega128 사용했고, Compiler는 Codevision AVR 2.04.4a 입니다.
---------------------------------------------------------------------------------------------------------------------------------------
#define T6963C_COMMAND_SetCursorPointer 0b00100001
#define T6963C_COMMAND_SetOffsetRegister 0b00100010
#define T6963C_COMMAND_SetAddressPointer 0b00100100
#define T6963C_COMMAND_SetTextHomeAddress 0b01000000
#define T6963C_COMMAND_SetTextArea 0b01000001
#define T6963C_COMMAND_SetGraphicHomeAddress 0b01000010
#define T6963C_COMMAND_SetGraphicArea 0b01000011
#define T6963C_COMMAND_WriteMode 0b10000000
// bit 2~0 : 0x00 - OR Mode
// bit 2~0 : 0x01 - EXOR Mode
// bit 2~0 : 0x03 - AND Mode
// bit 2~0 : 0x04 - Text Attribute Mode
// bit 3 : 0 - CG ROM Mode
// bit 3 : 1 - CG RAM Mode
#define WRITE_MODE_OR_MODE 0x00
#define WRITE_MODE_EXOR_MODE 0x01
#define WRITE_MODE_AND_MODE 0x03
#define WRITE_MODE_TEXT_ATTRIBUTE_MODE 0x04
#define WRITE_MODE_CG_RAM_MODE_ON 0x08
#define T6963C_COMMAND_SetModeOR 0b10000000
#define T6963C_COMMAND_SetModeEXOR 0b10000001
#define T6963C_COMMAND_SetModeAND 0b10000011
#define T6963C_COMMAND_SetModeTextAttribute 0b10000100
#define T6963C_COMMAND_SetModeCGROM 0b10000000
#define T6963C_COMMAND_SetModeCGRAM 0b10001000
#define T6963C_COMMAND_DisplayMode 0b10010000
// bit 3 : Graphic On
// bit 2 : Text On
// bit 1 : Cursor On
// bit 0 : Blink On
#define DISPLAY_MODE_GRAPHIC_ON 0x08
#define DISPLAY_MODE_TEXT_ON 0x04
#define DISPLAY_MODE_CURSOR_ON 0x02
#define DISPLAY_MODE_BLINK_ON 0x01
#define T6963C_COMMAND_SetDisplayOff 0b10010000
#define T6963C_COMMAND_SetCursorOnBlinkOff 0b10010010
#define T6963C_COMMAND_SetCursorOnBlinkOn 0b10010011
#define T6963C_COMMAND_SetTextOnGraphicOff 0b10010100
#define T6963C_COMMAND_SetTextOffGraphicOn 0b10011000
#define T6963C_COMMAND_SetTextOnGraphicOn 0b10011100
#define T6963C_COMMAND_SetCursorLine 0b10100000
// bit 2~0 : 0x00 - 1 Line Cursor
// bit 2~0 : 0x01 - 2 Line Cursor
// bit 2~0 : 0x02 - 3 Line Cursor
// bit 2~0 : 0x03 - 4 Line Cursor
// bit 2~0 : 0x04 - 5 Line Cursor
// bit 2~0 : 0x05 - 6 Line Cursor
// bit 2~0 : 0x06 - 7 Line Cursor
// bit 2~0 : 0x07 - 8 Line Cursor
#define CURSOR_LINE_1 0x00
#define CURSOR_LINE_2 0x01
#define CURSOR_LINE_3 0x02
#define CURSOR_LINE_4 0x03
#define CURSOR_LINE_5 0x04
#define CURSOR_LINE_6 0x05
#define CURSOR_LINE_7 0x06
#define CURSOR_LINE_8 0x07
#define T6963C_COMMAND_SetCursorLineTo1 0b10100000
#define T6963C_COMMAND_SetCursorLineTo2 0b10100001
#define T6963C_COMMAND_SetCursorLineTo3 0b10100010
#define T6963C_COMMAND_SetCursorLineTo4 0b10100011
#define T6963C_COMMAND_SetCursorLineTo5 0b10100100
#define T6963C_COMMAND_SetCursorLineTo6 0b10100101
#define T6963C_COMMAND_SetCursorLineTo7 0b10100110
#define T6963C_COMMAND_SetCursorLineTo8 0b10100111
#define T6963C_COMMAND_SetDataAutoWrite 0b10110000
#define T6963C_COMMAND_SetDataAutoRead 0b10110001
#define T6963C_COMMAND_SetAutoReset 0b10110010
#define T6963C_COMMAND_SetDataWriteIncreseADP 0b11000000
#define T6963C_COMMAND_SetDataReadIncreseADP 0b11000001
#define T6963C_COMMAND_SetDataWriteDecreseADP 0b11000010
#define T6963C_COMMAND_SetDataReadDecreseADP 0b11000011
#define T6963C_COMMAND_SetDataWriteMaintainADP 0b11000100
#define T6963C_COMMAND_SetDataReadMaintainADP 0b11000101
#define T6963C_COMMAND_SetScreenPeek 0b11100000
#define T6963C_COMMAND_SetScreenCopy 0b11101000
#define T6963C_COMMAND_SetBitReset 0b11110000
#define T6963C_COMMAND_SetBitSet 0b11111000
#define T6963C_COMMAND_SetSelectBit0 0b11110000
#define T6963C_COMMAND_SetSelectBit1 0b11110001
#define T6963C_COMMAND_SetSelectBit2 0b11110010
#define T6963C_COMMAND_SetSelectBit3 0b11110011
#define T6963C_COMMAND_SetSelectBit4 0b11110100
#define T6963C_COMMAND_SetSelectBit5 0b11110101
#define T6963C_COMMAND_SetSelectBit6 0b11110110
#define T6963C_COMMAND_SetSelectBit7 0b11110111
#define DATADIR_IN 0x00
#define DATADIR_OUT 0xFF
#define T6963C_DATADIR DDRA
#define T6963C_DATAIN PINA
#define T6963C_DATAOUT PORTA
#define T6963C_WR PORTC.4
#define T6963C_RD PORTC.5
#define T6963C_CE PORTC.2
#define T6963C_CD PORTC.3
#define T6963C_RST PORTC.0
#define T6963C_FS PORTC.1
#define T6963C_BK PORTC.7
#define T6963C_Graphic_RAM_Area 0x0000
#define T6963C_Graphic_Screen0 0x0000
#define T6963C_Graphic_Screen1 0x0F00
#define T6963C_Graphic_Screen2 0x1E00
#define T6963C_Graphic_Screen3 0x2D00
#define SCREEN_0 0
#define SCREEN_1 1
#define SCREEN_2 2
#define SCREEN_3 3
#define T6963C_Attribute_RAM_Area 0x3C00
#define T6963C_Text_RAM_Area 0x4000
#define T6963C_CG_RAM_Area 0x7C00
TypeUnionWord GRAPHIC_HOME_ADDRESS;
TypeUnionWord TEXT_HOME_ADDRESS;
TypeUnionWord GRAPHIC_ADDRESS;
byte GRAPHIC_AREA = 0x1E; // 8 bit Interval Division 30 x 8 = 240
byte TEXT_AREA = 0x1E; // 8 bit Interval Division 30 x 8 = 240
byte OFFSET_RESISTER = 0x0F; // CG RAM Address is 0x7800 ~ 0x7FFF
#define PIXEL_ON 1
#define PIXEL_OFF 0
flash byte MaskTable[] = { 0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80 };
// STATUS.0 : Check Command Execution Capability.
// STATUS.1 : Check Data Read/Write Capability.
// STATUS.2 : Check Auto Mode Data Read Capability.
// STATUS.3 : Check Auto Mode Data Write Capability.
// STATUS.4 : Not Used.
// STATUS.5 : Check Contoller Operation Capability.
// STATUS.6 : Error Flag. Used For Screen Peek and Screen Copy Commands. ( 0:No Error 1:Error )
// STATUS.7 : Check the Blink Condition. ( 0:Display Off 1:Normal Display )
byte T6963C_ReadStatus ( void )
{ byte ReturnValue;
T6963C_DATADIR = DATADIR_IN;
T6963C_CD = 1;
T6963C_CE = 0;
T6963C_RD = 0;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
ReturnValue = T6963C_DATAIN;
T6963C_RD = 1;
T6963C_CE = 1;
#asm ("nop");
#asm ("nop");
T6963C_DATADIR = DATADIR_OUT;
return ReturnValue;
}
byte T6963C_ReadData ( void )
{ byte ReturnValue;
T6963C_DATADIR = DATADIR_IN;
T6963C_CD = 0;
T6963C_CE = 0;
T6963C_RD = 0;
#asm ("nop");
#asm ("nop");
#asm ("nop");
#asm ("nop");
ReturnValue = T6963C_DATAIN;
T6963C_RD = 1;
T6963C_CE = 1;
#asm ("nop");
#asm ("nop");
T6963C_DATADIR = DATADIR_OUT;
return ReturnValue;
}
void T6963C_WriteInstruction ( byte Instruction )
{ T6963C_DATAOUT = Instruction;
T6963C_CD = 1;
T6963C_CE = 0;
T6963C_WR = 0;
#asm ("nop");
#asm ("nop");
T6963C_WR = 1;
T6963C_CE = 1;
#asm ("nop");
#asm ("nop");
}
void T6963C_WriteData ( byte Data )
{ T6963C_DATAOUT = Data;
T6963C_CD = 0;
T6963C_CE = 0;
T6963C_WR = 0;
#asm ("nop");
#asm ("nop");
T6963C_WR = 1;
T6963C_CE = 1;
#asm ("nop");
#asm ("nop");
}
void T6963C_WriteCommand0 ( byte Command )
{ while (( T6963C_ReadStatus() & 0x03 ) != 0x03 );
T6963C_WriteInstruction ( Command );
}
void T6963C_WriteCommand1 ( byte Command, byte Data0 )
{ while (( T6963C_ReadStatus() & 0x03 ) != 0x03 );
T6963C_WriteData ( Data0 );
while (( T6963C_ReadStatus() & 0x03 ) != 0x03 );
T6963C_WriteInstruction ( Command );
}
void T6963C_WriteCommand2 ( byte Command, byte Data0, byte Data1 )
{ while (( T6963C_ReadStatus() & 0x03 ) != 0x03 );
T6963C_WriteData ( Data0 );
while (( T6963C_ReadStatus() & 0x03 ) != 0x03 );
T6963C_WriteData ( Data1 );
while (( T6963C_ReadStatus() & 0x03 ) != 0x03 );
T6963C_WriteInstruction ( Command );
}
void T6963C_SetAddress ( word Address )
{ GRAPHIC_ADDRESS.Word = Address;
T6963C_WriteCommand2 ( T6963C_COMMAND_SetAddressPointer, GRAPHIC_ADDRESS.Byte[0], GRAPHIC_ADDRESS.Byte[1] );
}
void T6963C_SetAddressXY ( word StartX, word StartY )
{ GRAPHIC_ADDRESS.Word = (( StartX >> 0x03 ) + ( GRAPHIC_AREA * StartY ) + GRAPHIC_HOME_ADDRESS.Word );
T6963C_WriteCommand2 ( T6963C_COMMAND_SetAddressPointer, GRAPHIC_ADDRESS.Byte[0], GRAPHIC_ADDRESS.Byte[1] );
}
void T6963C_SetWriteMode ( byte WriteMode )
{ T6963C_WriteCommand0 ( T6963C_COMMAND_WriteMode | WriteMode );
}
void T6963C_Initialize ( void )
{
T6963C_RST = 0;
delay_ms (100);
T6963C_RST = 1;
delay_ms (10);
// 8 bit Interval Division 30 x 8 = 240
T6963C_FS = 0;
GRAPHIC_HOME_ADDRESS.Word = T6963C_Graphic_Screen0;
T6963C_WriteCommand2 ( T6963C_COMMAND_SetGraphicHomeAddress, GRAPHIC_HOME_ADDRESS.Byte[0], GRAPHIC_HOME_ADDRESS.Byte[1] );
T6963C_WriteCommand2 ( T6963C_COMMAND_SetGraphicArea, GRAPHIC_AREA, 0x00 );
TEXT_HOME_ADDRESS.Word = T6963C_Text_RAM_Area;
T6963C_WriteCommand2 ( T6963C_COMMAND_SetTextHomeAddress, TEXT_HOME_ADDRESS.Byte[0], TEXT_HOME_ADDRESS.Byte[1] );
T6963C_WriteCommand2 ( T6963C_COMMAND_SetGraphicArea, TEXT_AREA, 0x00 );
T6963C_WriteCommand2 ( T6963C_COMMAND_SetOffsetRegister, OFFSET_RESISTER, 0x00 );
T6963C_SetWriteMode ( WRITE_MODE_EXOR_MODE );
T6963C_WriteCommand0 ( T6963C_COMMAND_DisplayMode | DISPLAY_MODE_GRAPHIC_ON );
}