コード例 #1
0
ファイル: lcd.c プロジェクト: maxk9/etro_new
//-------------------------------------------------------------------------------------------------
// Write data to current position
//-------------------------------------------------------------------------------------------------
void GLCD_WriteData(unsigned char dataToWrite)
{
    while(GLCD_ReadStatus(screen_x / 64)&DISPLAY_STATUS_BUSY);
       
//    GPIO_StructInit(&GPIO_InitStructure);
//    GPIO_InitStructure.GPIO_Pin = (0xFF );
//    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
//    GPIO_Init(KS0108_PORT, &GPIO_InitStructure);
    
    GPIO_Init(KS0108_PORT,GPIO_PIN_ALL,GPIO_MODE_OUT_PP_LOW_FAST);

    GPIO_WriteLow(GPIOC, KS0108_RW);
    GLCD_Delay();
    GPIO_WriteHigh(GPIOC, KS0108_RS);
    GLCD_Delay();

	GPIO_Write(KS0108_PORT, (GPIO_Pin_TypeDef)(dataToWrite ));
    GLCD_Delay();
	
    GLCD_EnableController(screen_x / 64);
    GLCD_Delay();
    GPIO_WriteHigh(GPIOC, KS0108_EN);
    GLCD_Delay();
    GPIO_WriteLow(GPIOC, KS0108_EN);
    GLCD_Delay();
    GLCD_DisableController(screen_x / 64);
    screen_x++;
}
コード例 #2
0
ファイル: KS0108-AVR.c プロジェクト: srinivas-kr/AVR
//-------------------------------------------------------------------------------------------------
// Write command to specified controller
//-------------------------------------------------------------------------------------------------
void GLCD_WriteCommand(unsigned char commandToWrite, unsigned char controller)
{
while(GLCD_ReadStatus(controller)&DISPLAY_STATUS_BUSY);
KS0108_DATA_DIR = 0xFF;
KS0108_CTRL_PORT &= ~(KS0108_RW | KS0108_RS);
GLCD_EnableController(controller);
KS0108_DATA_PORT = commandToWrite;
KS0108_CTRL_PORT |= KS0108_EN;
GLCD_Delay();
KS0108_CTRL_PORT &= ~KS0108_EN;
GLCD_DisableController(controller);
}
コード例 #3
0
ファイル: KS0108-AVR.c プロジェクト: srinivas-kr/AVR
//-------------------------------------------------------------------------------------------------
// Read Status from specified controller (0-2)
//-------------------------------------------------------------------------------------------------
unsigned char GLCD_ReadStatus(unsigned char controller)
{
unsigned char status;
KS0108_DATA_DIR = 0x00;
KS0108_CTRL_PORT |= KS0108_RW;
KS0108_CTRL_PORT &= ~KS0108_RS;
GLCD_EnableController(controller);
KS0108_CTRL_PORT |= KS0108_EN;
GLCD_Delay();
status = KS0108_DATA_PIN;
KS0108_CTRL_PORT &= ~KS0108_EN;
GLCD_DisableController(controller);
return status;
}
コード例 #4
0
ファイル: KS0108-AVR.c プロジェクト: srinivas-kr/AVR
//-------------------------------------------------------------------------------------------------
// Write data to current position
//-------------------------------------------------------------------------------------------------
void GLCD_WriteData(unsigned char dataToWrite)
{
while(GLCD_ReadStatus(screen_x / 64)&DISPLAY_STATUS_BUSY);
KS0108_DATA_DIR = 0xFF;
KS0108_CTRL_PORT &= ~KS0108_RW;
KS0108_CTRL_PORT |= KS0108_RS;
KS0108_DATA_PORT = dataToWrite;
GLCD_EnableController(screen_x / 64);
KS0108_CTRL_PORT |= KS0108_EN;
GLCD_Delay();
KS0108_CTRL_PORT &= ~KS0108_EN;
GLCD_DisableController(screen_x / 64);
screen_x++;
}
コード例 #5
0
ファイル: glcd.c プロジェクト: naminic/Grafical-Lcd-Arm
//-------------------------------------
void GLCD_WriteData(unsigned char dataToWrite)
{
unsigned int byte;
DELAY() 	
PIO_Clear(&GLcdpins[2]);
PIO_Set(&GLcdpins[0]);	
byte = dataToWrite;
DATAPORT(byte);	
GLCD_EnableController(screen_x / 64);
PIO_Set(&GLcdpins[1]);
DELAY();	
PIO_Clear(&GLcdpins[1]);	
GLCD_DisableController(screen_x / 64);
screen_x++;
}
コード例 #6
0
ファイル: glcd.c プロジェクト: naminic/Grafical-Lcd-Arm
//-------------------------------------------------------------------------------------------------
//
//-------------------------------------------------------------------------------------------------
void GLCD_WriteCommand(unsigned char commandToWrite, unsigned char controller)
{
unsigned int command;
DELAY();

PIO_Clear(&GLcdpins[0]);
PIO_Clear(&GLcdpins[2]);
GLCD_EnableController(controller);
command=commandToWrite;
DATAPORT(command);	
PIO_Set(&GLcdpins[1]);	
DELAY();	
PIO_Clear(&GLcdpins[1]);	
GLCD_DisableController(controller);
}
コード例 #7
0
ファイル: KS0108-AVR.c プロジェクト: srinivas-kr/AVR
//-------------------------------------------------------------------------------------------------
// Read data from current position
//-------------------------------------------------------------------------------------------------
unsigned char GLCD_ReadData(void)
{
unsigned char data;
while(GLCD_ReadStatus(screen_x / 64)&DISPLAY_STATUS_BUSY);
KS0108_DATA_DIR = 0x00;
KS0108_CTRL_PORT |= (KS0108_RW | KS0108_RS);
GLCD_EnableController(screen_x / 64);
//GLCD_Delay();
KS0108_CTRL_PORT |= KS0108_EN;
GLCD_Delay();
data = KS0108_DATA_PIN;
KS0108_CTRL_PORT &= ~KS0108_EN;
GLCD_DisableController(screen_x / 64);
screen_x++;
return data;
}
コード例 #8
0
ファイル: lcd.c プロジェクト: maxk9/etro_new
//-------------------------------------------------------------------------------------------------
// Read Status byte from specified controller (0-2)
//-------------------------------------------------------------------------------------------------
unsigned char GLCD_ReadStatus(unsigned char controller)
{
    unsigned char status;

//    GPIO_StructInit(&GPIO_InitStructure);
//    GPIO_InitStructure.GPIO_Pin = 0xFF ;
//    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;
//    GPIO_Init(KS0108_PORT, &GPIO_InitStructure);
    GPIO_Init(KS0108_PORT,GPIO_PIN_ALL,GPIO_MODE_IN_PU_NO_IT);
    
    GPIO_WriteHigh(GPIOC, KS0108_RW);
    GPIO_WriteLow(GPIOC, KS0108_RS);
    GLCD_EnableController(controller);
    GLCD_Delay();
    GPIO_WriteHigh(GPIOC, KS0108_EN);
    GLCD_Delay();
    status = ((GPIO_ReadInputData(KS0108_PORT) ) & 0xFF);
    GPIO_WriteLow(GPIOC, KS0108_EN);
    GLCD_DisableController(controller);
    return status;
}
コード例 #9
0
ファイル: lcd.c プロジェクト: maxk9/etro_new
//-------------------------------------------------------------------------------------------------
// Write command to specified controller
//-------------------------------------------------------------------------------------------------
void GLCD_WriteCommand(unsigned char commandToWrite, unsigned char controller)
{
    while(GLCD_ReadStatus(controller)&DISPLAY_STATUS_BUSY);
//    GPIO_StructInit(&GPIO_InitStructure);
//    GPIO_InitStructure.GPIO_Pin  = (0xFF );
//    GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
//    GPIO_Init(KS0108_PORT, &GPIO_InitStructure);

    GPIO_Init(KS0108_PORT,GPIO_PIN_ALL,GPIO_MODE_OUT_PP_LOW_FAST);
    
    GPIO_WriteLow(GPIOC, (GPIO_Pin_TypeDef)(KS0108_RS | KS0108_RW));
    GLCD_Delay();
    GLCD_EnableController(controller);
    GLCD_Delay();
	GPIO_Write(KS0108_PORT, (GPIO_Pin_TypeDef)(commandToWrite ));
    GLCD_Delay();
    GPIO_WriteHigh(GPIOC, KS0108_EN);
    GLCD_Delay();
    GPIO_WriteLow(GPIOC, KS0108_EN);
    GLCD_Delay();
    GLCD_DisableController(controller);
}