[EthercatDevice_Dmp]
EthercatDevice_DmpLCD_Generic 是 ICOP 專為 LCD EtherCAT 從站模組開發的 EtherCAT 從站類別。它提供了多種繪圖 API。
The class relationships of EthercatDevice_DmpLCD_Generic are illustrated in the following diagram:

EthercatDevice_DmpLCD_Generic inherits from _EthercatDevice_DmpCommonDriver.
基本類別:
- _EthercatDevice_CommonDriver
衍生類別:
Class Name | Vendor ID | Product Code |
EthercatDevice_QECR11UN01 | 0x00000bc3 | 0x0086d103 |
EthercatDevice_QECR00UN01 | 0x00000bc3 | 0x0086d100 |
LCD 模組清單:
ID | LCM Driver IC | Resolution | Xp | Yp | Xm | Ym |
0 | ILI9341 | 240 X 320 | D9 | A2 | A3 | D8 |
1 | ILI9341 | 240 X 320 | D6 | A1 | A2 | D7 |
2 | ILI9488 | 320 X 480 | D8 | A3 | A2 | D9 |
3 | ILI9486 | 320 X 480 | X | X | X | X |
4 | HX8347-I(T) | 240 X 320 | D9 | A2 | A3 | D8 |
5 | HX8347-D | 240 X 320 | D9 | A2 | A3 | D8 |
LCD Module List:
ECAT_LCD_UNKNOWN_ID (0xFFFF)
ECAT_LCD_ILI9341_1 (0)
ECAT_LCD_ILI9341_2 (1)
ECAT_LCD_ILI9488_1 (2)
ECAT_LCD_ILI9486_1 (3)
ECAT_LCD_HX8347I_1 (4)
ECAT_LCD_HX8347D_1 (5)
關於 RGB565
RGB565 是一種色彩格式,用來表示影像中像素的色彩資訊。它使用 16 位元組(2 位元組)來編碼單一像素的色彩資訊。「RGB565」這個名稱表示位元在三原色(紅、綠、藍)之間的分佈。
- 紅色 ( R ): 5 位元
- 綠色 ( G ): 6 位元
- 藍色 ( B ): 5 位元
這會讓綠色優先於紅色和藍色,因為人眼對綠色的變化比紅色和藍色更敏感。

由於分配給每個色彩元件的位元數較少,RGB565 提供的調色板比 24 位元 RGB 或 16 位元 RGB 更小。它可以表示 25 = 32 個紅色和藍色的可能值,以及 26 = 64 種可能的綠色值,因此總共有 32 x 64 x 32 = 65,536 種可能的顏色。
以下是一些 RGB565 顏色代碼,以供快速參考和方便測試:

將 RGB888 轉換為 RGB565
從 24 位元 RGB 轉換為 RGB565 需要一個稱為色彩量化的過程。類似於 24 位元與 16 位元 RGB 之間的轉換,此過程會減少顏色的數量,並在 RGB565 調色板中為它們指定最接近的可用顏色。這可能會造成一些色彩損失,但對於某些應用程式來說,以色彩精確度來換取效率是可以接受的。以下是在 C 程式碼中將 RGB888 轉換為 RGB565 的範例。
uint16_t rgb888_to_rgb565(uint8_t r, uint8_t g, uint8_t b) { return ((r >> 3) << 11) | ((g >> 2) << 5) | (b >> 3); }
初始化函式 ( Initialization Functions )
EthercatDevice_DmpLCD_Generic 類別的初始化相關函式。
控制函式 ( Control Functions )
EthercatDevice_DmpLCD_Generic 類別的控制函式。
LCD 函式 ( LCD Functions )
EthercatDevice_DmpLCD_Generic 類別的LCD函式。
- lcdInit()
- lcdFlush()
- lcdWidth()
- lcdHeight()
- lcdGetRotation()
- lcdSetRotation()
- lcdDrawPixel()
- lcdDrawFastHLine()
- lcdDrawFastVLine()
- lcdDrawLine()
- lcdFillRect()
- lcdDrawRect()
- lcdFillCircle()
- lcdDrawCircle()
- lcdFillTriangle()
- lcdDrawTriangle()
- lcdFillRoundRect()
- lcdDrawRoundRect()
- lcdFillScreen()
- lcdSetAddrWindow()
- lcdPushColors()
- lcdSetTextCursor()
- lcdSetTextColor()
- lcdSetTextSize()
- lcdSetTextWrap()
- lcdPrint()
觸控螢幕函式 ( Touch Screen Functions )
EthercatDevice_DmpLCD_Generic 類別的觸控螢幕函式。
Please see the EtherCAT Library User Manual for more QEC EtherCAT instructions and API usage.