筆者會使用 PIC24FJ64GA008 連接 2.8吋 TFT LCD 液晶屏,雖然 PIC24 蕊片的 I/O 接口已經是較 PIC18 增加,但感覺仍然要小心謹慎,不要浪費珍貴的 I/O 接口,2.8吋 TFT LCD 液晶屏模塊接口是 2x17 34腳的排針插座,可以選擇 16位、8位或 SPI 連接,所以筆者會選用 8位的 8080-II 方式連接 LCD 液晶屏,直接減少 I/O 接口。
PIC24FJ64GA008 2.8吋 TFT LCD 液晶屏電路圖(Schematic) |
2.8吋 TFT LCD 液晶屏 2x17 34腳的接口 |
2.8吋 TFT LCD ILI9341電阻式觸摸液晶屏模組 2x17 34腳的定義:
Pin
|
Signal
|
Description
|
Pin
|
Signal
|
Description
|
1
|
LCD_CS
|
Chip
Select
|
2
|
LCD_RS
|
Command/Data
|
3
|
LCD_WR
|
Wrire
|
4
|
LCD_RD
|
Read
|
5
|
LCD_RST
|
Reset
|
6
|
DB1
|
D1
|
7
|
DB2
|
D2
|
8
|
DB3
|
D3
|
9
|
DB4
|
D4
|
10
|
DB5
|
D5
|
11
|
DB6
|
D6
|
12
|
DB7
|
D7
|
13
|
DB8
|
D8
|
14
|
DB10
|
D10
|
15
|
DB11
|
D11
|
16
|
DB12
|
D12
|
17
|
DB13
|
D13
|
18
|
DB14
|
D14
|
19
|
DB15
|
D15
|
20
|
DB16
|
D16
|
21
|
DB17
|
D17
|
22
|
SD_CS
|
SD Chip Select
|
23
|
BL_CTR
|
Back
Light Control
|
24
|
VCC
|
Power
|
25
|
VCC
|
Power
|
26
|
GND
|
Ground
|
27
|
GND
|
Ground
|
28
|
NC
|
NC
|
29
|
SPI_MISO
|
Touch
Data Ouput
|
30
|
SPI_MOSI
|
Touch Data Input
|
31
|
T_PEN
|
Touch Interrupt
|
32
|
FLASH_CS
|
Flash Chip Select
|
33
|
T_CS
|
Touch Chip Select
|
34
|
SPI_CLK
|
Touch Clock
|
Microchip PIC24FJ64GA008 2.8吋 TFT LCD 液晶屏接腳程式定義:
//Definition for data BUS #define DAT_TRIS_BIT TRISE #define DAT_LAT_BIT LATE #define DAT_PORT_BIT PORTE // Definitions for Backlight enable pin #define LED_TRIS_BIT TRISDbits.TRISD9 // Output #define LED_LAT_BIT LATDbits.LATD9 // Definitions for Reset pin #define RST_TRIS_BIT TRISDbits.TRISD13 #define RST_LAT_BIT LATDbits.LATD13 // Definitions for CS pin #define CS_TRIS_BIT TRISDbits.TRISD11 #define CS_LAT_BIT LATDbits.LATD11 // Definitions for RD pin #define RD_TRIS_BIT TRISDbits.TRISD5 #define RD_LAT_BIT LATDbits.LATD5 // Definitions for WR pin #define WR_TRIS_BIT TRISDbits.TRISD4 #define WR_LAT_BIT LATDbits.LATD4 // Definitions for RS pin #define RS_TRIS_BIT TRISFbits.TRISF4 #define RS_LAT_BIT LATFbits.LATF4 |
Microchip PIC24FJ64GA008 和 2.8吋 TFT LCD 液晶屏連接:
LCD
|
Signal
|
MCU
|
Signal
|
LCD
|
Signal
|
MCU
|
Signal
|
1
|
LCD_CS
|
57
|
RD11
|
2
|
LCD_RS
|
39
|
RF4
|
3
|
LCD_WR
|
66
|
PMWR
|
4
|
LCD_RD
|
67
|
RD5
|
5
|
LCD_RST
|
65
|
RF4
|
6
|
DB1
|
GND
|
|
7
|
DB2
|
GND
|
8
|
DB3
|
GND
|
||
9
|
DB4
|
GND
|
10
|
DB5
|
GND
|
||
11
|
DB6
|
GND
|
12
|
DB7
|
GND
|
||
13
|
DB8
|
GND
|
14
|
DB10
|
76
|
PMD0
|
|
15
|
DB11
|
77
|
PMD1
|
16
|
DB12
|
78
|
PMD2
|
17
|
DB13
|
79
|
PMD3
|
18
|
DB14
|
80
|
PMD4
|
19
|
DB15
|
1
|
PMD5
|
20
|
DB16
|
2
|
PMD6
|
21
|
DB17
|
3
|
PMD7
|
22
|
SD_CS
|
||
23
|
BL_CTR
|
55
|
RD9
|
24
|
VCC
|
3.3V
|
|
25
|
VCC
|
3.3V
|
26
|
GND
|
GND
|
||
27
|
GND
|
GND
|
28
|
NC
|
|||
29
|
SPI_MISO
|
30
|
SPI_MOSI
|
||||
31
|
T_PEN
|
32
|
FLASH_CS
|
||||
33
|
T_CS
|
34
|
SPI_CLK
|
2016年 6月 9日 天氣報告
氣溫:29.2度 @ 16:40
相對濕度:百分之 82%
天氣:微雨※ 端午節快樂
沒有留言:
張貼留言