示例#1
0
文件: Lcd.cs 项目: josemotta/Netduino
        /// <summary>
        /// Sets entire display (D) on/off, cursor on/off (C),
        /// and blinking of cursor position character (B).
        /// </summary>
        /// <param name="cursorBlinking">Blinking of cursor</param>
        /// <param name="cursorChar">Cursor position char</param>
        /// <param name="displayStatus">Display Status On/Off</param>
        private void DisplayControl(CursorBlinking cursorBlinking, CursorChar cursorChar, DisplayStatus displayStatus)
        {
            //  DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
            //  0   0   0   0   1   D   C   B

            byte displayCtrlCmd = DISPLAY_CONTROL;

            // blinking of cursor
            if (cursorBlinking == CursorBlinking.Yes)
            {
                displayCtrlCmd |= BLINK_CURSOR_ENABLE;
            }
            this.blinkCursor = (cursorBlinking == CursorBlinking.Yes);

            // display cursor position char
            if (cursorChar == CursorChar.Display)
            {
                displayCtrlCmd |= CURSOR_CHAR_ENABLE;
            }
            this.showCursor = (cursorChar == CursorChar.Display);

            // display status on/off
            if (displayStatus == DisplayStatus.On)
            {
                displayCtrlCmd |= DISPLAY_STATUS_ON;
            }
            this.displayOn = (displayStatus == DisplayStatus.On);

            this.SendCommand(displayCtrlCmd); // 37 us (datasheet)
        }
示例#2
0
        /// <summary>
        /// Sets entire display (D) on/off, cursor on/off (C), 
        /// and blinking of cursor position character (B).
        /// </summary>
        /// <param name="cursorBlinking">Blinking of cursor</param>
        /// <param name="cursorChar">Cursor position char</param>
        /// <param name="displayStatus">Display Status On/Off</param>
        private void DisplayControl(CursorBlinking cursorBlinking, CursorChar cursorChar, DisplayStatus displayStatus)
        {
            //  DB7 DB6 DB5 DB4 DB3 DB2 DB1 DB0
            //  0   0   0   0   1   D   C   B

            byte displayCtrlCmd = DISPLAY_CONTROL;

            // blinking of cursor
            if (cursorBlinking == CursorBlinking.Yes)
                displayCtrlCmd |= BLINK_CURSOR_ENABLE;
            this.blinkCursor = (cursorBlinking == CursorBlinking.Yes);

            // display cursor position char
            if (cursorChar == CursorChar.Display)
                displayCtrlCmd |= CURSOR_CHAR_ENABLE;
            this.showCursor = (cursorChar == CursorChar.Display);

            // display status on/off
            if (displayStatus == DisplayStatus.On)
                displayCtrlCmd |= DISPLAY_STATUS_ON;
            this.displayOn = (displayStatus == DisplayStatus.On);

            this.SendCommand(displayCtrlCmd); // 37 us (datasheet)
        }