void Sleep() //进入睡眠模式 { SendCMD(LCD12864_CMD_EXTEND); SendCMD(LCD12864_EXTCMD_SLEEP(0)); }
void Wakeup() //从睡眠模式唤醒 { SendCMD(LCD12864_CMD_EXTEND); SendCMD(LCD12864_EXTCMD_SLEEP(1)); }
void Cursor_right()//游标向右移动,AC=AC { SendCMD(LCD12864_CMD_CURXY(0,1)); }
void Line_Inverse(uchar line) //第line行显示反白 { SendCMD(LCD12864_CMD_EXTEND); SendCMD(LCD12864_EXTCMD_INVERSE(line)); }
void ClearRAM() { SendCMD(LCD12864_CMD_RSTDDRAM); LongDelay(100*DELAY4MS); }
void Cursor_left() //游标向左移动,AC=AC { SendCMD(LCD12864_CMD_CURXY(0,0)); }
void Cursor_off() { SendCMD(LCD12864_CMD_DISP(1,0,0)); }
//==================================================================================== void SetPageAddress(uint8_t add) { SendCMD(0xB0 | add); }
void Direct_Right() { SendCMD(LCD12864_CMD_SETCUR(1,0)); }
void Cursor_on() { SendCMD(LCD12864_CMD_DISP(1,0,1)); }
void Direct_left() { SendCMD(LCD12864_CMD_SETCUR(0,0)); }
void Display_off() { SendCMD(LCD12864_CMD_DISP(0,0,0)); }
void Display_on() { SendCMD(LCD12864_CMD_DISP(1,0,0)); }
void PutChar(uchar row,uchar col,uchar cc) //X表示第几个字,Y表示第几行,cc表示字符; { SendCMD(LCD_ADDR[row][col]); SendData(cc); }
void Scroll_left() //整体向左移动,AC=AC { SendCMD(LCD12864_CMD_CURXY(1,0)); }
void Draw_off() { SendCMD(LCD12864_CMD_EXTEND); //8Bit扩充指令集,即使是36H也要写两次 SendCMD(LCD12864_EXTCMD_MODE(1,0)); //绘图OFF,基本指令集里面36H不能开绘图 }
void Scroll_right()//整体向右移动,AC=AC { SendCMD(LCD12864_CMD_CURXY(1,1)); }
//==================================================================================== void InitOLED(void) { OLED_InitIF(); // Setup hardware interface OLED_ResetAssert(); // Put display into reset OLED_MsDelay(200); // Delay for 200ms OLED_ResetDeassert(); // Bring display out of reset OLED_MsDelay(200); // Delay for 200ms SendCMD(OLED_CMD_OFF); // turn off oled panel SendCMD(OLED_CMD_CLOCK); // set display clock divide ratio/oscillator frequency SendCMD(0x80); // set divide ratio SendCMD(OLED_CMD_MULTIPLEXER); // set multiplex ratio(1 to 64) SendCMD(0x3f); // 1/64 duty SendCMD(OLED_CMD_OFFSET); // set display offset SendCMD(0x00); // not offset SendCMD(OLED_CMD_CHARGE_PUMP); // set Charge Pump enable/disable SendCMD(0x14); // set(0x10) disable SendCMD(OLED_CMD_START_LINE); // set start line address SendCMD(OLED_CMD_NORMAL_MODE); // set normal display SendCMD(OLED_CMD_ENABLE_DISPLAY); // Disable Entire Display On SendCMD(OLED_CMD_SEGMENT_REMAP); // set segment re-map 128 to 0 SendCMD(OLED_CMD_SCAN_DIRECTION); // Set COM Output Scan Direction 64 to 0 SendCMD(OLED_CMD_COM_PIN_CONFIG); // set com pins hardware configuration SendCMD(0x12); SendCMD(OLED_CMD_SET_CONTRAST); // set contrast control register SendCMD(Contrast_level); SendCMD(OLED_CMD_SET_PRE_CHARGE); // set pre-charge period SendCMD(0xf1); SendCMD(OLED_CMD_SET_VCOMH); // set vcomh SendCMD(0x40); SendCMD(OLED_CMD_ADD_MODE); SendCMD(0x02); SendCMD(OLED_CMD_ON); // turn on oled panel }
/***************************** 发送字符串 *****************************/ void ClearLCD() //在当前模式下清屏幕 { SendCMD(LCD12864_CMD_CLEAR); LongDelay(100*DELAY4MS); }