//------------------------------------------------------------------------------------------------- // // Writes data // //------------------------------------------------------------------------------------------------- void T6963::writeData(byte data){ while(!(checkStatus()&0x03)); // GLCD_DATA_PORT = data; GLCD_DATA_PORT1 &= ~GLCD_DATA_MASK1; GLCD_DATA_PORT1 |= (data GLCD_DATA_SHIFT1); GLCD_DATA_PORT2 &= ~GLCD_DATA_MASK2; GLCD_DATA_PORT2 |= (data GLCD_DATA_SHIFT2); GLCD_CTRL_PORT &= ~((1 << GLCD_WR) | (1 << GLCD_CE) | (1 << GLCD_CD)); n_delay(); GLCD_CTRL_PORT |= ((1 << GLCD_WR) | (1 << GLCD_CE) | (1 << GLCD_CD)); }
//------------------------------------------------------------------------------------------------- // // Writes instruction // //------------------------------------------------------------------------------------------------- void T6963::writeCommand(byte command){ while(!(checkStatus()&0x03)); // GLCD_DATA_PORT = command; GLCD_DATA_PORT1 &= ~GLCD_DATA_MASK1; GLCD_DATA_PORT1 |= (command GLCD_DATA_SHIFT1); GLCD_DATA_PORT2 &= ~GLCD_DATA_MASK2; GLCD_DATA_PORT2 |= (command GLCD_DATA_SHIFT2); GLCD_CTRL_PORT &= ~((1 << GLCD_WR) | (1 << GLCD_CE)); n_delay(); GLCD_CTRL_PORT |= ((1 << GLCD_WR) | (1 << GLCD_CE)); }
//------------------------------------------------------------------------------------------------- // // Writes data // //------------------------------------------------------------------------------------------------- void GLCD_WriteData(unsigned char data) { while(!(GLCD_ChceckStatus()&0x03)); // GLCD_DATA_PORT = data; GLCD_DATA_PORT1 &= ~GLCD_DATA_MASK1; GLCD_DATA_PORT1 |= (data GLCD_DATA_SHIFT1); GLCD_DATA_PORT2 &= ~GLCD_DATA_MASK2; GLCD_DATA_PORT2 |= (data GLCD_DATA_SHIFT2); GLCD_CTRL_PORT &= ~((1 << GLCD_WR) | (1 << GLCD_CE) | (1 << GLCD_CD)); n_delay(); GLCD_CTRL_PORT |= ((1 << GLCD_WR) | (1 << GLCD_CE) | (1 << GLCD_CD)); }
//------------------------------------------------------------------------------------------------- // // Writes instruction // //------------------------------------------------------------------------------------------------- void GLCD_WriteCommand(unsigned char command) { while(!(GLCD_ChceckStatus()&0x03)); // GLCD_DATA_PORT = command; GLCD_DATA_PORT1 &= ~GLCD_DATA_MASK1; GLCD_DATA_PORT1 |= (command GLCD_DATA_SHIFT1); GLCD_DATA_PORT2 &= ~GLCD_DATA_MASK2; GLCD_DATA_PORT2 |= (command GLCD_DATA_SHIFT2); GLCD_CTRL_PORT &= ~((1 << GLCD_WR) | (1 << GLCD_CE)); n_delay(); GLCD_CTRL_PORT |= ((1 << GLCD_WR) | (1 << GLCD_CE)); }
//------------------------------------------------------------------------------------------------- // // Reads dispay status // //------------------------------------------------------------------------------------------------- byte T6963::checkStatus(void){ uint8_t tmp; //GLCD_DATA_DDR = 0x00; GLCD_DATA_DDR1 &= ~GLCD_DATA_MASK1; GLCD_DATA_DDR2 &= ~GLCD_DATA_MASK2; GLCD_CTRL_PORT &= ~((1 << GLCD_RD) | (1 << GLCD_CE)); n_delay(); //tmp = GLCD_DATA_PIN; tmp = (GLCD_DATA_PIN1 GLCD_DATA_RSHIFT1) | (GLCD_DATA_PIN2 GLCD_DATA_RSHIFT2); //GLCD_DATA_DDR = 0xFF; GLCD_DATA_DDR1 |= GLCD_DATA_MASK1; GLCD_DATA_DDR2 |= GLCD_DATA_MASK2; GLCD_CTRL_PORT |= ((1 << GLCD_RD) | (1 << GLCD_CE)); return tmp; }
//------------------------------------------------------------------------------------------------- // // Reads data // //------------------------------------------------------------------------------------------------- unsigned char GLCD_ReadData(void) { uint8_t tmp; while(!(GLCD_ChceckStatus()&0x03)); //GLCD_DATA_DDR = 0x00; GLCD_DATA_DDR1 &= ~GLCD_DATA_MASK1; GLCD_DATA_DDR2 &= ~GLCD_DATA_MASK2; GLCD_CTRL_PORT &= ~((1 << GLCD_RD) | (1 << GLCD_CE) | (1 << GLCD_CD)); n_delay(); //tmp = GLCD_DATA_PIN; tmp = (GLCD_DATA_PIN1 GLCD_DATA_RSHIFT1) | (GLCD_DATA_PIN2 GLCD_DATA_RSHIFT2); GLCD_CTRL_PORT |= ((1 << GLCD_RD) | (1 << GLCD_CE) | (1 << GLCD_CD)); //GLCD_DATA_DDR = 0xFF; GLCD_DATA_DDR1 |= GLCD_DATA_MASK1; GLCD_DATA_DDR2 |= GLCD_DATA_MASK2; return tmp; }
//------------------------------------------------------------------------------------------------- // // Reads data // //------------------------------------------------------------------------------------------------- byte T6963::ReadData(void){ byte tmp; while(!(checkStatus()&0x03)); //GLCD_DATA_DDR = 0x00; GLCD_DATA_DDR1 &= ~GLCD_DATA_MASK1; GLCD_DATA_DDR2 &= ~GLCD_DATA_MASK2; GLCD_CTRL_PORT &= ~((1 << GLCD_RD) | (1 << GLCD_CE) | (1 << GLCD_CD)); n_delay(); //tmp = GLCD_DATA_PIN; tmp = (GLCD_DATA_PIN1 GLCD_DATA_RSHIFT1) | (GLCD_DATA_PIN2 GLCD_DATA_RSHIFT2); GLCD_CTRL_PORT |= ((1 << GLCD_RD) | (1 << GLCD_CE) | (1 << GLCD_CD)); //GLCD_DATA_DDR = 0xFF; GLCD_DATA_DDR1 |= GLCD_DATA_MASK1; GLCD_DATA_DDR2 |= GLCD_DATA_MASK2; return tmp; }