void LCDCharacter(char character) { uint8_t index; SendLCD(DATA, 0x00); for (index = 0; index < 5; index++) { SendLCD(DATA, ASCII[character - 0x20][index]); } SendLCD(DATA, 0x00); }
void ClearLCD() { int i; #ifdef _8051f120 LCD_rst = 1; LCD_en = 0; LCD_cs = 1; #else #endif SendLCD(0,0x32); // control 1 SendLCD(0x1,0x7); SendLCD(0x2,0x1d); SendLCD(0x3,0x3f); // DETERMIN HOW MANY POINTS ON THE LCD 101 - 6 DOTS SendLCD(LCD_ADDRESS_LO,0x00); // START LCD ADDRESS 1 SendLCD(LCD_ADDRESS_HI,0x00); // START LCD ADDRESS 2 SendLCD(LCD_CURSOR_ADDRESS_LO,0x00); // set cursor address 1 SendLCD(LCD_CURSOR_ADDRESS_HI,0x00); // set cursor address 2 for (i=1920; i > 0; i--) // go over all the chars and zero them { SendLCD(LCD_CHAR_REG, 0x00); // put 8 bit to LCD } }
int LCDClear(void) { uint16_t i; for ( i = 0; i < LCDWIDTH*LCDHEIGHT/8 ; i++) SendLCD(DATA,0x00); }
void LCDPlotbits(UCHAR inX, UCHAR inY, UCHAR inBit) // draws a 8bit to the screen { // calc the posision in the LCD UINT pos; UCHAR addrLow, addrHi; pos = (inY * LCD_CHARS_IN_LINE) + inX; //addrLow = &(UCHAR)pos; //addrHi = addrLow +1; addrLow = pos; addrHi = pos>>8; SendLCD(LCD_CURSOR_ADDRESS_LO,addrLow); // START LCD ADDRESS 1 SendLCD(LCD_CURSOR_ADDRESS_HI,addrHi); // START LCD ADDRESS 2 //printf("Hi %d, Low %d, POS %d\r\n", addrHi, addrLow, pos); SendLCD(LCD_BITS_REG_SET, inBit); // put 8 bit to LCD }
void LCDInit(uint8_t CLK, uint8_t DIN , uint8_t DC , uint8_t CE ,uint8_t RST,uint8_t CONTRAST) { LCDCtrl.CLK = CLK; LCDCtrl.DIN = DIN; LCDCtrl.DC = DC; LCDCtrl.CE = CE; LCDCtrl.RST = RST; LCDCtrl.CONTRAST = CONTRAST; pinMode(LCDCtrl.CLK , OUTPUT); pinMode(LCDCtrl.DIN , OUTPUT); pinMode(LCDCtrl.DC , OUTPUT); pinMode(LCDCtrl.CE , OUTPUT); pinMode(LCDCtrl.RST , OUTPUT); #if 0 // Reset the controller state... digitalWrite(LCDCtrl.RST, HIGH); digitalWrite(LCDCtrl.CE, HIGH); digitalWrite(LCDCtrl.RST, LOW); delay(100); digitalWrite(LCDCtrl.RST, HIGH); // Set the LCD parameters... SendLCD(CMD, 0x21); // extended instruction set control (H=1) SendLCD(CMD, 0x13); // bias system (1:48) // if (this->model == CHIP_ST7576) { // SendLCD(CMD, 0xe0); // higher Vop, too faint at default // SendLCD(CMD, 0x05); // partial display mode // } else { SendLCD(CMD, 0xc2); // default Vop (3.06 + 66 * 0.06 = 7V) // } SendLCD(CMD, 0x20); // extended instruction set control (H=0) SendLCD(CMD, 0x09); // all display segments on // Clear RAM contents... LCDClear(); // Activate LCD... SendLCD(CMD, 0x08); // display blank SendLCD(CMD, 0x0c); // normal mode (0x0d = inverse mode) delay(100); // Place the cursor at the origin... SendLCD(CMD, 0x80); SendLCD(CMD, 0x40); #else digitalWrite(LCDCtrl.CE , LOW); digitalWrite(LCDCtrl.RST, LOW); digitalWrite(LCDCtrl.RST, HIGH); digitalWrite(LCDCtrl.CE , HIGH); SendLCD(CMD,0x21); SendLCD(CMD,0xB2); SendLCD(CMD,0x04); SendLCD(CMD,0x14); SendLCD(CMD,0x0C); SendLCD(LOW, 0x20); SendLCD(LOW, 0x0C); #endif //Setup Contrast SendLCD(CMD, 0x21); // extended instruction set control (H=1) SendLCD(CMD, 0x80 | (LCDCtrl.CONTRAST & 0x7f)); SendLCD(CMD, 0x20); // extended instruction set control (H=0) LCDClear(); }
void gotoXY(uint8_t x, uint8_t y) { SendLCD( 0, 0x80 | x); // Column. SendLCD( 0, 0x40 | y); // Row. }